Explore topic-wise MCQs in Java.

This section includes 58 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.

1.

For a recursive algorithm _________

A. a base case is necessary and is solved without recursion.
B. a base case is not necessary
C. doesnot solve a base case directly
D. none of the mentioned
Answer» C. doesnot solve a base case directly
2.

If for an algorithm time complexity is given by O(n²) then complexity will ___________

A. constant
B. quadratic
C. exponential
D. none of the mentioned
Answer» C. exponential
3.

Which is used to measure the Time complexity of an algorithm Big O notation?

A. describes limiting behaviour of the function
B. characterises a function based on growth of function
C. upper bound on growth rate of the function
D. all of the mentioned
Answer» E.
4.

The worst case complexity for insertion sort is _________

A. O(n)
B. O(log n)
C. O(n²)
D. O(n log n)
Answer» D. O(n log n)
5.

An algorithm which uses the past results and uses them to find the new results is _________

A. Brute Force
B. Divide and Conquer
C. Dynamic programming algorithms
D. None of the mentioned
Answer» D. None of the mentioned
6.

Which algorithm is better for sorting between bubble sort and quicksort?

A. bubble sort
B. quick sort
C. both are equally good
D. none of the mentioned
Answer» C. both are equally good
7.

If for an algorithm time complexity is given by O((3⁄2)ⁿ) then complexity will be ___________

A. constant
B. quardratic
C. exponential
D. none of the mentioned
Answer» D. none of the mentioned
8.

The decimal notation of 101010101 is ___________

A. 340₁₀
B. 341₁₀
C. 342₁₀
D. 315₁₀
Answer» C. 342₁₀
9.

The binary notation of ABBA is ___________

A. 1010 1011 1011 1010
B. 1010 1001 1011 1011
C. 1011 1000 1010 1001
D. 1001 1000 1000 1111
Answer» B. 1010 1001 1011 1011
10.

The value of 12 mod 3 is?

A. 0
B. 1
C. 2
D. 3
Answer» B. 1
11.

The worst case complexity of quick sort is _________

A. O(n)
B. O(log n)
C. O(n²)
D. O(n log n)
Answer» D. O(n log n)
12.

The time complexity of binary search is given by ___________

A. constant
B. quardratic
C. exponential
D. none of the mentioned
Answer» E.
13.

The greatest common divisor of 7 and 5 is?

A. 1
B. 2
C. 5
D. 7
Answer» B. 2
14.

A Complexity of algorithm depends upon _________

A. Time only
B. Space only
C. Both Time and Space
D. None of the mentioned
Answer» D. None of the mentioned
15.

For an algorithm which is the most important characteristic that makes it acceptable _________

A. Fast
B. Compact
C. Correctness and Precision
D. None of the mentioned
Answer» D. None of the mentioned
16.

An algorithm which tries all the possibilities unless results are satisfactory is and generally is time-consuming is _________

A. Brute Force
B. Divide and Conquer
C. Dynamic programming algorithms
D. None of the mentioned
Answer» B. Divide and Conquer
17.

The octal expansion of (10 1011 1011)₂ is ___________

A. (1245)₈
B. (1276)₈
C. (1275)₈
D. (1273)₈
Answer» E.
18.

Optimization of algorithm means _________

A. making that algorithm fast by time and compact by space
B. making that algorithm slow by time and large by space
C. making that algorithm fast by time and large by space
D. making that algorithm slow by time and compact by space
Answer» B. making that algorithm slow by time and large by space
19.

An algorithm in which we divide the problem into subproblem and then we combine the subsolutions to form solution to the original problem is known as _________

A. Brute Force
B. Divide and Conquer
C. GreedyAlgorithm
D. None of the mentioned
Answer» C. GreedyAlgorithm
20.

Is 102 congruent to 6 modulo 16.

A. True
B. False
C. May be True or False
D. Can't say
Answer» B. False
21.

The greatest common divisor of 414 and 662 is?

A. 4
B. 5
C. 2
D. 6
Answer» D. 6
22.

The binary notation of 231 is ___________

A. (11010111)₂
B. (10111011)₂
C. (11100011)₂
D. (11100111)₂
Answer» E.
23.

An algorithm can be represented through _________

A. flow charts
B. pseudo codes
C. instructions in common language
D. all of the mentioned
Answer» E.
24.

The complexity of Fibonacci series is _________

A. O(2ⁿ)
B. O(log n)
C. O(n²)
D. O(n log n)
Answer» B. O(log n)
25.

The complexity of linear search algorithm is _________

A. O(n)
B. O(log n)
C. O(n²)
D. O(n log n)
Answer» B. O(log n)
26.

If for an algorithm time complexity is given by O(n) then the complexity of it is ___________

A. constant
B. linear
C. exponential
D. none of the mentioned
Answer» C. exponential
27.

The hexadecimal expansion of (177130)₁₀ is ___________

A. (2B3EB)₁₆
B. (2B3EA)₁₆
C. (2C3AA)₁₆
D. (2B2AA)₁₆
Answer» C. (2C3AA)₁₆
28.

If for an algorithm time complexity is given by O(log₂n) then complexity will be ___________

A. constant
B. polynomial
C. exponential
D. none of the mentioned
Answer» E.
29.

The quotient and remainder when -1 is divided by 3 is?

A. -1 and -1
B. -1 and 2
C. 1 and 2
D. -1 and -2
Answer» C. 1 and 2
30.

The greatest common divisor of 12 and 18 is?

A. 2
B. 3
C. 4
D. 6
Answer» E.
31.

The complexity of merge sort algorithm is _________

A. O(n)
B. O(log n)
C. O(n²)
D. O(n log n)
Answer» E.
32.

Time complexity of the binary search algorithm is constant.

A. True
B. False
C. May be True or False
D. Can't say
Answer» C. May be True or False
33.

The Worst case occur in linear search algorithm when _________

A. Item is somewhere in the middle of the array
B. Item is not in the array at all
C. Item is the last element in the array
D. Item is the last element in the array or is not there at all
Answer» E.
34.

The worst case occurs in quick sort when _________

A. Pivot is the median of the array
B. Pivot is the smallest element
C. Pivot is the middle element
D. None of the mentioned
Answer» C. Pivot is the middle element
35.

An Algorithm is ___________

A. A procedure for solving a problem
B. A problem
C. A real life mathematical problem
D. None of the mentioned
Answer» B. A problem
36.

The complexity of Binary search algorithm is _________

A. O(n)
B. O(logn)
C. O(n²)
D. O(n log n)
Answer» C. O(n²)
37.

There are two algorithms suppose A takes 1.41 milli seconds while B takes 0.9 milliseconds, which one of them is better considering all other things the same?

A. A is better than B
B. B is better than A
C. Both are equally good
D. None of the mentioned
Answer» C. Both are equally good
38.

If for an algorithm time complexity is given by O(1) then the complexity of it is ____________

A. constant
B. polynomial
C. exponential
D. none of the mentioned
Answer» B. polynomial
39.

The time complexity of the linear search is given by ___________

A. O(log₂n)
B. O(1)
C. exponential
D. none of the mentioned
Answer» E.
40.

The hexadecimal notation of (1011 0111 1011)₂ is ___________

A. (B2B)₁₆
B. (B5B)₁₆
C. (B7B)₁₆
D. (A7B)₁₆
Answer» D. (A7B)₁₆
41.

If a|b and a|c, then?

A. a|bc
B. c|a
C. a|(b+c)
D. b|a
Answer» D. b|a
42.

The value of 155 mod 9 is?

A. 0
B. 1
C. 2
D. 3
Answer» D. 3
43.

Is 17 congruent to 4 modulo 6.

A. True
B. False
C. May be True or False
D. Can't say
Answer» C. May be True or False
44.

The decimal expansion of (2AE0B)₁₆ is?

A. (175627)₁₀
B. (175624)₁₀
C. (178566)₁₀
D. (175622)₁₀
Answer» B. (175624)₁₀
45.

The quotient and remainder when 18 is divided by 5 is?

A. 2 and 3
B. 1 and 2
C. 3 and 2
D. 3 and 3
Answer» E.
46.

The value of 15 mod 11 is?

A. 1
B. 2
C. 3
D. 4
Answer» E.
47.

The quotient when 19 is divided by 6 is?

A. 1
B. 2
C. 3
D. 0
Answer» D. 0
48.

The remainder when 111 is divided by 12 is?

A. 0
B. 1
C. 2
D. 3
Answer» E.
49.

The Worst case occurs in linear search algorithm when ____________

A. Item is somewhere in the middle of the array
B. Item is not in the array at all
C. Item is the last element in the array
D. Item is the last element in the array or is not there at all
Answer» E.
50.

List obtained in third pass of selection sort for list 3, 5, 4, 1, 2 is ___________

A. 1, 2, 4, 3, 5
B. 1, 2, 3, 4, 5
C. 1, 5, 4, 3, 2
D. 3, 5, 4, 1, 2
Answer» C. 1, 5, 4, 3, 2