MCQ
MCQ
MCQ
Answer: b) and d)
import java.util.*;
public class TestMain
{
public static void main(String[] args)
{
String[] str = { “Banana”, “Apple”,”Watermelon”, “Mango” };
sortFruit o = new sortFruit();
Arrays.sort(str, o);
for (String s : str)
System.out.print(s + “ “ );
System.out.println(Arrays.binarySearch(str, “map”));
}
Answer: a)
a) Tower of Hanoi
b) Sum of n Digits
c) Find even or odd
d) Fibonacci series
Answer: d)
a. <person country="India">
b. <person country=India>
c. <person country;"India">
d. <person country,"India">
Answer: a)
5) Given:
class TestMain {
public static void main(String[] args) {
check();
check(10);
check(10,20);
}
//insert code here
}
Which of the following statement can replace // insert code here, that
will compile without any errors? (Choose all that apply.)
Answer: a)
class Mammal {
String name = "Dog ";
String makeNoise() {
return "BOW WOW";
}
}
String makeNoise() {
return "Meow";
}
}
void go() {
Mammal m = new Cat();
System.out.println(m.name + m.makeNoise());
}
}
a) Cat Meow
b) Dog BOW WOW
c) Dog Meow
d) Cat BOW WOW
Answer: c)
Answer: d)
}
a) Linear Search
b) Binary Search
c) Merge Sort
d) Quick Sort
Answer: a)
class TestMain {
static String s = "*";
void s1() {
try {
S2();
} catch (Exception e) {
S += "c";
}
}
a) *c
b) *c22b
c) *c2
d) *c2b
e) *22b
Answer: a)
10) Select the statements that are true about Persistence?
a) Persistence is a way through which the life time of object exists even after the
program terminates
b) Java uses serialization for object persistence
c) Java uses serialization for object persistence
d) Persistence of object is done by java runtime automatically
Answer: a),b)
11) Consider eth following table structure and write a query to display all
the employees who have and don’t have department id assigned
Emp(fname,lname,dno)
Dept(deptid, dname)
Answer: a),b)
12) Which key can be used to change the mode from input mode to command
mode ?
a. Esc
b. Esc + i
c. Esc + a
d. Esc + l
Answer: a)
13) Carefully read the question and answer accordingly.
Analysis of selection algorithm eliminates ______ number of elements
each time.
a) n elements
b) n/2 elements
c) n/4 elements
d) (n/2)+n elements
Answer: a)
class Milon {
Milon() {
}
Milon(Milon m) {
m1 = m;
}
Milon m1;
void go() {
System.out.print("hi ");
}
}
a) hi
b) hi hi
c) hi hi hi
d) hi hi followed by Exception
e) hi followed by Exception
Answer: d)
15) Which of the given phases consume more time during the Software life
cycle.
a) Analysis
b) Design
c) Testing
d) Maintenance
Answer: d)