Explore topic-wise MCQs in Technical Programming.

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

351.

What are the valid White Spaces available in Java language?

A. Space
B. Enter
C. Tab
D. All the above
Answer» E.
352.

A valid Identifier or name in Java language can start with which character?

A. a-z, A-Z
B. $, _
C. 0-9
D. A and B
Answer» E.
353.

A valid identifier in Java language may contain which characters?

A. 0-9
B. A-Z, a-z
C. $, _ (Underscore)
D. All the above
Answer» E.
354.

Name of a Class, Variable, Method or an Interface in Java language is called?

A. Argument
B. Value
C. Identifier
D. None of the above
Answer» D. None of the above
355.

What is the default return type of a method in Java language?

A. void
B. int
C. short
D. None of the above
Answer» E.
356.

String args[] in main method are used for?

A. Passing arguments at compile time
B. Passing arguments at run time
C. Counting number of words
D. Nothing
Answer» C. Counting number of words
357.

Choose a multiline comment in Java language below?

A. /*comments are going
B. */comments are going
C. //comments are going
D. None of the above
Answer» B. */comments are going
358.

Choose a Single Line Comment in Java Language below?

A. //Some comments
B. Some comments//
C. /*Some comments*/
D. */Some comments/*
Answer» B. Some comments//
359.

What is the use of Access modifier "pubic" in Java language?

A. To hide the main method from misuse
B. To call the main method outside of Class or Package by JVM
C. To protect main method
D. None of the above
Answer» C. To protect main method
360.

In standalone Java applications, which method is mandatory?

A. main method
B. show method
C. display method
D. print method
Answer» B. show method
361.

What is the need to mention "static" before main method?

A. To call main method without creating an object of class
B. To make main method as class method common to all instances
C. Both A and B
D. None of the above
Answer» D. None of the above
362.

All methods and variables in Java language are kept inside a?

A. File
B. Class or Interface
C. static method
D. main
Answer» C. static method
363.

A function in C language is similar to what in Java language?

A. Method
B. Member
C. Variable
D. None of the above
Answer» B. Member
364.

Every statement in Java language should end with a?

A. Dot or Period
B. Comma
C. Semicolon
D. Colon
Answer» D. Colon
365.

Choose the correct statement about Java Prefix and Postfix operations.

A. Prefix operation is carried out immediately and the variable value will be incremented or decremented accordingly
B. Postfix operation is carried out on the next line or statement. So the variable value will not change.
C. A and B
D. None of the above
Answer» D. None of the above
366.

Among the operator groups (++, --) and (+, -, *, /, %) in Java, which group has higher priority?

A. (++, --) group has higher priority than (+, -, *, /, %) group
B. (++, --) group has lower priority than (+, -, *, /, %) group
C. (++, --) group and (+, -, *, /, %) group have equal priority
D. None of the above
Answer» B. (++, --) group has lower priority than (+, -, *, /, %) group
367.

Choose the correct statement about Java Operators +, -, *, / and %.

A. + and - have equal priority
B. * and / have equal priority
C. / and % have equal priority
D. All the above
Answer» E.
368.

Increment and Decrement arithmetic operators in Java has which Associativity?

A. Left to Right
B. Right to Left
C. Left to Left
D. Right to Right
Answer» C. Left to Left
369.

Among Postfix Decrement and Prefix Increment operators in Java, which operator has less priority?

A. Postfix Decrement has less priority than Prefix Increment
B. Prefix Increment has less priority than Postfix Decrement
C. Both operators have same priority
D. None of the above
Answer» C. Both operators have same priority
370.

Between Postfix and Prefix arithmetic operators in Java, which operators have more priority?

A. Postfix operators have more priority than Prefix operators
B. Prefix operators have more priority than Postfix operators
C. Both Prefix and Postfix operators have equal priority
D. None of the above
Answer» B. Prefix operators have more priority than Postfix operators
371.

Arithmetic operators +, -, /, *  and % have which Associativity?

A. Right to Left
B. Left to Right
C. Right to Right
D. Left to Left
Answer» C. Right to Right
372.

Which is the arithmetic operator in Java that gives the Remainder of Division?

A. /
B. @
C. %
D. &
Answer» D. &
373.

How do you rewrite the below Java code snippet?

A. p=%3;
B. p%=3;
C. p=3%;
D. None of the above
Answer» C. p=3%;
374.

What is the output of Java code snippet?

A. 1
B. 2
C. 3
D. Compiler error about Type Casting
Answer» D. Compiler error about Type Casting
375.

What is the output of Java code snippet below?

A. 1
B. 2
C. 3
D. Compiler error
Answer» E.
376.

Choose the Compound Assignment Arithmetic Operators in Java below.

A. +=, -=
B. *=, /=
C. %=
D. All the above
Answer» E.
377.

An Arithmetic expression in Java involves which Operators or Operations?

A. Addition (+), Subtraction (-)
B. Multiplication (*), Division (/)
C. Modulo Division (%), Increment/Decrement (++/--), Unary Minus (-), Unary Plus (+)
D. All the above
Answer» E.
378.

Which of the interface contains all the methods used for handling thread related operations in Java?

A. Runnable interface
B. Math interface
C. System interface
D. ThreadHandling interface
Answer» B. Math interface
379.

How many String objects have been created?

A. 2
B. 3
C. 4
D. 5
Answer» D. 5
380.

What value will this program return to Java run-time system?

A. 0
B. 1
C. 4
D. 5
Answer» E.
381.

Will this program generate same output is executed again?

A. Yes
B. No
C. Compiler Dependent
D. Operating System Dependent
Answer» C. Compiler Dependent
382.

What will be the output of the program (in jdk1.6 or above)?

A. z
B. x z
C. y z
D. Compilation fails.
Answer» C. y z
383.

What will be the output of the program?1. A2. B3. C4. D

A. 1 and 3
B. 2 and 4
C. 3 and 4
D. 1 and 2
Answer» B. 2 and 4
384.

Select how you would start the program to cause it to print: Arg is 2

A. java Myfile 222
B. java Myfile 1 2 2 3 4
C. java Myfile 1 3 2 2
D. java Myfile 0 1 2 3
Answer» D. java Myfile 0 1 2 3
385.

What is the value of "d" after this line of code has been executed?

A. 2
B. 3
C. 4
D. 2.5
Answer» C. 4
386.

What would be the output of following code snippet?int a = random.nextInt(7) + 4;

A. Random number between 4 to 7, including 4 and 7
B. Random number between 4 to 7, excluding 4 and 7
C. Random number between 4 to 10, excluding 4 and 10
D. Random number between 4 to 10, including 4 and 10
Answer» E.
387.

What is the output of below code snippet?

A. Test – 10Test – 10
B. Test – 10
C. Runtime Exception
D. Compilation Failure
Answer» B. Test – 10
388.

What is the output of below snippet?

A. {1=null, 2=null, 3=null, 4=null, 5=null}
B. {5=null}
C. Exception is thrown
D. {1=null, 5=null, 3=null, 2=null, 4=null}
Answer» B. {5=null}
389.

PriorityQueue is thread safe.

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

Set has contains(Object o) method.

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

What are the use of front and rear pointers in CircularQueue implementation?

A. Front pointer points to first element; rear pointer points to the last element
B. Rear pointer points to first element; front pointer points to the last element
C. Front and read pointers point to the first element
D. Front pointer points to the first element; rear pointer points to null object
Answer» D. Front pointer points to the first element; rear pointer points to null object
392.

Math.random() guarantees uniqueness?

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

What is the unique feature of LinkedHashSet?

A. It is not a valid class
B. It maintains the insertion order and guarantees uniqueness
C. It provides a way to store key values with uniqueness
D. The elements in the collection are linked to each other
Answer» C. It provides a way to store key values with uniqueness
394.

Which of these is a class which uses String as a key to store the value in object?

A. Array
B. ArrayList
C. Dictionary
D. Properties
Answer» E.
395.

Which of these class object uses the key to store value?

A. Dictionary
B. Map
C. Hashtable
D. All of the mentioned
Answer» E.
396.

What would be the output of following code snippet?int a = random.nextInt(15) + 1;

A. Random number between 1 to 15, including 1 and 15
B. Random number between 1 to 15, excluding 15
C. Random number between 1 to 15, excluding 1
D. Random number between 1 to 15, excluding 1 and 15
Answer» B. Random number between 1 to 15, excluding 15
397.

Which of this interface is not a part of Java’s collection framework?

A. List
B. Set
C. SortedMap
D. SortedList
Answer» E.
398.

What is the correct method used to insert and delete items from the queue?

A. push and pop
B. enqueue and dequeue
C. enqueue and peek
D. add and remove
Answer» C. enqueue and peek
399.

Which of the following are valid calls to Math.max?1. Math.max(1,4)2. Math.max(2.3, 5)3. Math.max(1, 3, 5, 7)4. Math.max(-1.5, -2.8f)

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

What two statements are true about the result obtained from calling Math.random()?1. The result is less than 0.0.2. The result is greater than or equal to 0.0..3. The result is less than 1.0.4. The result is greater than 1.0.5. The result is greater than or equal to 1.0.

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