0% found this document useful (0 votes)
44 views

Select The Packages in Which JDBC Classes Are Defined?

The document contains 15 multiple choice questions related to mathematics, probability, and programming concepts. The questions cover topics like percentages, averages, probability, speed, pipes filling tanks, cards, remainders, and highest common factors.

Uploaded by

mohd salahuddin
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Select The Packages in Which JDBC Classes Are Defined?

The document contains 15 multiple choice questions related to mathematics, probability, and programming concepts. The questions cover topics like percentages, averages, probability, speed, pipes filling tanks, cards, remainders, and highest common factors.

Uploaded by

mohd salahuddin
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Multiple choice questions

1. What will be the order of binary search?

a) O (n) b) O (n2)

C) O (n!) d) O (logn)

2. The algorithm of order O (n logn) is called as?

a) Linear algorithm b) Exponential algorithm

c) Super linear algorithm d) Factorial algorithm

3. What is the range of the int data type?

a) –2,147,483,648 to 2,147,483,647 b) -2,147,483,647 to 2,147,483,648

c) -32,768 to 32,767 d) -32,767 to 32,768

4. How many types of JDBC drivers are available?


a) 3 b) 4

c) 5 d) 6

5. What is used to convert the byte-oriented stream into character-oriented stream?


a) Console b) Scanner

c) InputStreamReader d) DataInputStream

6. Which class can be used to read data line by line using the readLine() method?

a) BufferedReader b) InputStreamReader

c) DataInputStream d) None of the above

7. Generally string is a sequence of characters, but in java, string is an _______.


a) Variable b) Class

c) Package d) Object

8. Select the packages in which JDBC classes are defined?

a) jdbc and javax.jdbc b) rdb and javax.rdb

c) jdbc and java.jdbc.sql d) java.sql and javax.sql


9. Analyze the following code and choose the correct answer.

int[] arr = new int[5];

arr = new int[6];

a) The code has compile errors because the variable arr cannot be changed once it is assigned.

b) The code has runtime errors because the variable arr cannot be changed once it is assigned.

c) The code can compile and run fine. The second line assigns a new array to arr.

d) The code has compile errors because we cannot assign a different size array to arr.

10. What will be the output?

public class Test{

public static void main(String[] args){

int[] a = new int[4];

a[1] = 1;

a = new int[2];

System.out.println("a[1] is " + a[1]);

a) The program has a compile error because new int[2] is null

b) The program has a runtime error because a[1] is not referenced

c) a[1] is 0

d) a[1] is 1

11. What is the value of a[1] after the following code is executed?
int[] a = {0, 2, 4, 1, 3};

for(int i = 0; i < a.length; i++)

a[i] = a[(a[i] + 3) % a.length];

A) 0

B) 1

C) 2

D) 3

E) 4

12. What would be the result of attempting to compile and run the following code?

public class HelloWorld{

public static void main(String[] args){

double[] x = new double[]{1, 2, 3};

System.out.println("Value is " + x[1]);

a) The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should
be replaced by {1, 2, 3}.

b) The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should
be replaced by new double[3]{1, 2, 3};

c) The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should
be replaced by new double[]{1.0, 2.0, 3.0};

d) The program compiles and runs fine and the output is 2.0
13. What is the output for the below code?

public class Test{

public static void main(String[] args){

int i = 010;

int j = 07;

System.out.println(i);

System.out.println(j);

a) 8

b) 10

c) Compilation fails with an error at line 3

d) Compilation fails with an error at line 5

14 .What will be the output for the below code?

public class Test{

public static void main(String[] args){

byte i = 128;

System.out.println(i);

a) 128
b) 0

c) Compilation fails with an error at line 3

d) Compilation fails with an error at line 4

15.What will be the output for the below code ?

public class Test{

int i=8;

int j=9;

public static void main(String[] args){

add();

public static void add(){

int k = i+j;

System.out.println(k);

a) 17

b) 0

c) Compilation fails with an error at line 5

d) Compilation fails with an error at line 8


1) If 30% of a certain number is 12.6, what is the number?

a) 24
b) 42
c) 23
d) 32

1) The speed of a boat in still water is 5km/hr. If the speed of the boat against the stream is 3 km/hr, what is the speed
of the stream?

a) 1.5 km/hr
b) 2 km/hr
c) 2.5 km/hr
d) 1 km/hr

A pipe can fill a tank in 6 hours and another pipe can empty the tank in 12 hours. If both the pipes are opened at the
same time, the tank can be filled in

a) 10 hours
b) 12 hours
c) 14 hours
d) 16 hours

Three pipes A, B and C can fill a cistern in 8 minutes,12 minutes and 16 minutes respectively. What is the time taken by
three pipes to fill the cistern when they are opened together?

a) 3.7 minutes
b) 4 minutes
c) 4.5 minutes
d) 5 minutes

Two pipes working together can fill a fish tank in 12 minutes. If one pipe fills the fish tank 10 minutes faster than the
second pipe, in what time the second pipe alone can fill the fish tank?

a) 20 minutes
b) 25 minutes
c) 30 minutes
d) 35 minutes

Two boys start running at the same time in the same direction at a speed of 10 km/hr and 12 km/hr respectively. In what
time they will be 8 km apart?

a) 3 hours
b) 4 hours
c) 5 hours
d) 6 hours

 A horse covers a certain distance in 40 minutes if it runs at a speed of 60 km/hr. At what speed the horse can cover the
same distance in 30 minutes?

a) 80 km/hr
b) 82 km/hr
c) 84 km/hr
d) 86 km/hr

In a bag, there are 8 red, 7 yellow and 6 green balls. If one ball is picked up at random, what is the probability that it is
neither red nor green?

e) 1/4
f) 1/2
g) 1/5
h) 1/3

 In a group of students, there are 15 boys and 10 girls. If three students are selected at random, what is the probability
that 1 girl and 2 boys are selected?

a) 21/46
b) 21/36
c) 21/26
d) 21/56

A man draws two cards together from a pack of 52 cards. What is the probability of both the cards being kings?

e) 1/111
f) 1/121
g) 1/221
h) 1/321

 Average of five numbers is 20. If each number is multiplied by 2, what will be the new average?

A. 30
B. 40
C. 50
D. 60

If the average of three consecutive even numbers is 34, find the largest of these numbers.

A. 30
B. 32
C. 34
D. 36

If the number 467X4 is divisible by 9, find the value of the digit marked as X.

a) 4
b) 5
c) 6
d) 7
45 ? = 35% of 900

a) 6
b) 7
c) 9
d) 4

If 40% of an amount is 250, what will be 60% of that amount?

a) 300
b) 320
c) 375
d) 400

What is the HCF of 1095 and 1168?

a) 37
b) 73
c) 43
d) 83

You might also like