Some Multiple choice questions in Java
Question Number 1
Which code segment could execute the stored procedure "countRecs()" located in a database server?
Choice 1
Statement stmt = connection.createStatement();
stmt.execute("COUNTRECS()");
Choice 2
CallableStatement cs = con.prepareCall("{call COUNTRECS}");
cs.executeQuery();
Choice 3
StoreProcedureStatement spstmt = connection.createStoreProcedure("countRecs()");
spstmt.executeQuery();
Choice 4
PrepareStatement pstmt = connection.prepareStatement("countRecs()");
pstmt.execute();
Choice 5
Statement stmt = connection.createStatement();
stmt.executeStoredProcedure("countRecs()");
------------------------------------------------------------
Question Number 2
if(check4Biz(storeNum) != null) {}
Referring to the above, what datatype could be returned by method check4Biz()?
Choice 1
Boolean
Choice 2
int
Choice 3
String
Choice 4
char
Choice 5
byte
------------------------------------------------------------
Question Number 3
int j;
for(int i=0;i<14;i++) j =" 2" i="0;i<" count="1;" id="KonaLink0" target="undefined" class="kLink" style="text-decoration: underline ! important; position: static;" href="http://go4experts.blogspot.com/"> system will exit
------------------------------------------------------------
Question Number 7
System.getProperties().put(
"java.rmi.server.codebase",
"http://www.domain.com/classes/");
Which one of the following is a capability of the above code?
Choice 1
Override CLASSPATH
Choice 2
Register an rmi server on its host system
Choice 3
Set the location of all applets in a web server
Choice 4
Append CLASSPATH
Choice 5
Facilitate dynamic class loading for remote objects
------------------------------------------------------------
Question Number 8
Which one of the following statements is FALSE?
Choice 1
Java supports multi-threaded programming.
Choice 2
Threads in a single program can have different priorities.
Choice 3
Multiple threads can manipulate files and get user input at the same time.
Choice 4
Two threads can never act on the same object at the same time.
Choice 5
Threads are created and started with different methods.
------------------------------------------------------------
Question Number 9
1 public static void main(String[] s) {
2 String n1, n2, n3;
3 n1 = "n1";
4 n2 = "n2";
5 n3 = "n3";
6 {
7 String n4 = "inner";
8 n2 = n1;
9 }
10 n3 = null;
11 }
How many instances of the String will be eligible for garbage collection after line 10 in the above code snippet is executed?
Choice 1
0
Choice 2
1
Choice 3
2
Choice 4
3
Choice 5
The code will not compile.
------------------------------------------------------------
Question Number 10
Which code declares class A to belong to the mypackage.financial package?
Choice 1
package mypackage;
package financial;
Choice 2
import mypackage.*;
Choice 3
package mypackage.financial.A;
Choice 4
import mypackage.financial.*;
Choice 5
package mypackage.financial;
Which code segment could execute the stored procedure "countRecs()" located in a database server?
Choice 1
Statement stmt = connection.createStatement();
stmt.execute("COUNTRECS()");
Choice 2
CallableStatement cs = con.prepareCall("{call COUNTRECS}");
cs.executeQuery();
Choice 3
StoreProcedureStatement spstmt = connection.createStoreProcedure("countRecs()");
spstmt.executeQuery();
Choice 4
PrepareStatement pstmt = connection.prepareStatement("countRecs()");
pstmt.execute();
Choice 5
Statement stmt = connection.createStatement();
stmt.executeStoredProcedure("countRecs()");
------------------------------------------------------------
Question Number 2
if(check4Biz(storeNum) != null) {}
Referring to the above, what datatype could be returned by method check4Biz()?
Choice 1
Boolean
Choice 2
int
Choice 3
String
Choice 4
char
Choice 5
byte
------------------------------------------------------------
Question Number 3
int j;
for(int i=0;i<14;i++) j =" 2" i="0;i<" count="1;" id="KonaLink0" target="undefined" class="kLink" style="text-decoration: underline ! important; position: static;" href="http://go4experts.blogspot.com/"> system will exit
------------------------------------------------------------
Question Number 7
System.getProperties().put(
"java.rmi.server.codebase",
"http://www.domain.com/classes/");
Which one of the following is a capability of the above code?
Choice 1
Override CLASSPATH
Choice 2
Register an rmi server on its host system
Choice 3
Set the location of all applets in a web server
Choice 4
Append CLASSPATH
Choice 5
Facilitate dynamic class loading for remote objects
------------------------------------------------------------
Question Number 8
Which one of the following statements is FALSE?
Choice 1
Java supports multi-threaded programming.
Choice 2
Threads in a single program can have different priorities.
Choice 3
Multiple threads can manipulate files and get user input at the same time.
Choice 4
Two threads can never act on the same object at the same time.
Choice 5
Threads are created and started with different methods.
------------------------------------------------------------
Question Number 9
1 public static void main(String[] s) {
2 String n1, n2, n3;
3 n1 = "n1";
4 n2 = "n2";
5 n3 = "n3";
6 {
7 String n4 = "inner";
8 n2 = n1;
9 }
10 n3 = null;
11 }
How many instances of the String will be eligible for garbage collection after line 10 in the above code snippet is executed?
Choice 1
0
Choice 2
1
Choice 3
2
Choice 4
3
Choice 5
The code will not compile.
------------------------------------------------------------
Question Number 10
Which code declares class A to belong to the mypackage.financial package?
Choice 1
package mypackage;
package financial;
Choice 2
import mypackage.*;
Choice 3
package mypackage.financial.A;
Choice 4
import mypackage.financial.*;
Choice 5
package mypackage.financial;
No comments:
Post a Comment