[Go to site: main page, start]

0% found this document useful (0 votes)
18 views8 pages

JDBC Class Package Selection Quiz

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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views8 pages

JDBC Class Package Selection Quiz

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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

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 [Link] b) rdb and [Link]

c) jdbc and [Link] d) [Link] and [Link]


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];

[Link]("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 < [Link]; i++)

a[i] = a[(a[i] + 3) % [Link]];

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};

[Link]("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;

[Link](i);

[Link](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;

[Link](i);

a) 128
b) 0

c) Compilation fails with an error at line 3

d) Compilation fails with an error at line 4

[Link] 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;

[Link](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

Common questions

Powered by AI

An algorithm with a time complexity of O(n logn) is referred to as a super linear algorithm .

Solving problems involving multiple pipes with different filling rates involves understanding individual rates and then combining them to find a net rate. This analysis facilitates efficient resource management, such as optimizing water distribution systems . When three pipes fill a cistern in different times, for example, their rates are added to find a collective time of operation, useful in engineering scenarios to maximize utility.

Understanding probability is crucial for determining the likelihood of events in fields such as statistics, finance, and gambling. For example, calculating the probability of drawing two kings from a standard deck involves combinations and provides foundational knowledge for more complex statistical reasoning . The probability is 1/221, derived from choosing 2 kings out of 52 cards.

To calculate the net time for filling a tank with two pipes, one filling and the other emptying, calculate their rates individually and then determine the net combined rate. The importance lies in practical applications such as water supply and drainage systems where understanding net flow rates is crucial . For instance, if one pipe fills a tank in 6 hours, its rate is 1/6 tank/hour, while another empties it in 12 hours with a rate of -1/12 tank/hour, the net rate is 1/6 - 1/12 = 1/12, filling the tank in 12 hours.

A number is divisible by 9 if the sum of its digits is divisible by 9. This rule applies to base-10 numbers and stems from the properties of modular arithmetic. For instance, for the number 467X4, X must be chosen such that the sum of the digits (4+6+7+X+4) is divisible by 9 .

The range of the int data type is typically –2,147,483,648 to 2,147,483,647. This range is defined based on a 32-bit signed integer representation, allowing for 2^31 values for both positive and negative integers (including zero).

The expected time complexity of a binary search algorithm on a sorted list is O(logn).

Reassigning an array in Java to a new array with a different size is valid and compiles successfully. The original array reference is simply updated to point to the new array, and the old array becomes eligible for garbage collection if no other references to it exist .

In Java, a byte-oriented stream can be converted to a character-oriented stream using an InputStreamReader. This conversion is necessary for handling character data correctly because byte streams deal with raw binary data, whereas character streams are designed to handle text data with correct encoding (such as UTF-8).

In Java, integers prefixed with a zero are interpreted as octal numbers (base 8). This means that any arithmetic operation involving such numbers will be computed in the octal numbering system unless explicitly cast to decimal . For instance, int i = 010 will be interpreted as 8 in decimal.

You might also like