Beruflich Dokumente
Kultur Dokumente
Note: PLEASE DONT WRITE ANYTHING ON THE QUESTION PAPER. USE ANSWER SHEET TO MARK
YOUR ANSWERS.
1) Which of the following are Java keywords? Select the three correct answers.
A. external
B. implement
C. throw
D. void
E. integer
F. private
G. synchronize
H. unsigned
3) Which of the following function does not give outputs which are linearly separable when all
possible combinations of binary inputs are given
a. AND
b. OR
c. XOR
d. NAND
a.
b.
c.
d.
[]
Index Error: list index out of range
[a, b, c, d, e]
[e]
6) A page is brought into memory only when a location on that page is actually referenced
during execution is
a. Pre paging
b. Thrashing
c. Demand paging
d. Page fault
6
5
sizeof(p) + 1
compile error
a.
b.
c.
d.
45545
56655
54554
compile error
12) Does the minimum spanning tree of a graph give the shortest distance between any 2
specified nodes?
a. Yes
b. No
compile error
4
64
syntax error
15) Can user-defined object be declared as static data member of another class?
a. Yes
b. No
I know c
I know c++
cquestionbankI know c
cquestionbankI know c++
10
50
Compile error
initialization error
20) Which of these are legal array declarations or definitions? Select the two correct answers.
a. int[] []x[];
b. int *x;
c. int x[5];
d. int[] x = {1,2,3};
class test {
a.
b.
c.
d.
e.
22) What gets printed when the following program is compiled and run. Select the one correct
answer.
1.
2.
3.
4.
5.
6.
4486
4488
4466
4386
4388
4468
23) What is the result of compiling and running the following program. Select the one correct
answer.
class test {
public static void main(String args[]) {
char ch;
String test2 = "abcd";
String test = new String("abcd");
if(test.equals(test2)) {
if(test == test2)
ch = test.charAt(0);
else
ch = test.charAt(1);
}
else {
if(test == test2)
ch = test.charAt(2);
else
ch = test.charAt(3);
}
1.
2.
3.
4.
'a'
'b'
'c'
'd'
24) What is the result of compiling and running the following program. Select the one correct
answer.
class test {
public static void main(String args[]) {
int[] arr = {1,2,3,4};
call_array(arr[0], arr);
System.out.println(arr[0] + "," + arr[1]);
}
static void call_array(int i, int arr[]) {
arr[i] = 6;
i = 5;
}
}
a.
b.
c.
d.
1,2
5,2
1,6
5,6
class check {
public static void main(String args[]) {
System.out.println(args[args.length-2]);
}
}
26) Select the one most appropriate answer. What is the purpose of method parseInt defined in
Integer class.
a. The method converts an integer to a String.
b. The method is used to convert String to an integer, assuming that the String
represents an integer.
c. The method is used to convert String to Integer class, assuming that the
String represents an integer.
d. The method converts the Integer object to a String.
27) What should be done to invoke the run() method on a thread for an object derived from the
Thread class. Select the one correct answer.
a. The run() method should be directly invoked on the Object.
b. The start() method should be directly invoked on the Object.
c. The init() method should be directly invoked on the Object.
d. The creation of the object using the new operator would create a new
thread and invoke its run() method.
29) What gets printed when the following program is compiled and run? Select the one correct
answer.
class test {
static boolean check;
public static void main(String args[]) {
int i;
if(check == true)
i=1;
else
i=2;
if(i=2) i=i+2;
else i = i + 4;
System.out.println(i);
}
}
a.
b.
c.
d.
e.
3
4
5
6
The program does not compile because of the statement if(i=2)
int i = 5;
boolean t = true;
float f = 2.3F;
double d = 2.3;
a. t = (boolean) i;
b. f = d;
1. d = i;
c. i = 5;
d. f = 2.8;