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.

1101.

What is the output of this program? class Output { public static void main(String args[]) { double x = 102; double y = 5; double z = Math.IEEEremainder(x, y); System.out.print(z);} } }

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

What is the output of this program? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.toDegrees(x); System.out.print(y); } }

A. 0
B. 179
C. 180
D. 360
Answer» C. 180
1103.

toRadian() and toDegree() methods were added by which version of Java?

A. Java 1.0
B. Java 1.5
C. Java 2.0
D. Java 3.0
Answer» D. Java 3.0
1104.

Which of these method converts radians to degrees?

A. toRadian()
B. toDegree()
C. convertRadian()
D. converDegree()
Answer» C. convertRadian()
1105.

Which of these method returns the remainder of dividend / divisor?

A. remainder()
B. getRemainder()
C. CSIremainder()
D. IEEEremainder()
Answer» E.
1106.

Which of these method return a pseudorandom number?

A. rand()
B. random()
C. randomNumber()
D. randGenerator()
Answer» C. randomNumber()
1107.

Which of these class contains all the methods present in Math class?

A. SystemMath
B. StrictMath
C. Compiler
D. ClassLoader
Answer» C. Compiler
1108.

What is the output of this program? class Output { public static void main(String args[]) { String x = Boolean.toString(false); } }

A. True
B. False
C. System Dependent
D. Compilation Error
Answer» C. System Dependent
1109.

What is the output of this program? class Output { public static void main(String args[]) { String str = "true false"; boolean x = Boolean.parseBoolean(str); System.out.print(x); } }

A. True
B. False
C. System Dependent
D. Compilation Error
Answer» C. System Dependent
1110.

What is the output of this program? class Output { public static void main(String args[]) { String str = "true false true"; boolean x = Boolean.valueOf(str); System.out.print(x); } }

A. True
B. False
C. Compilation Error
D. Runtime Error
Answer» C. Compilation Error
1111.

What is the output of this program? class Output { public static void main(String args[]) { String str = "true"; boolean x = Boolean.valueOf(str); System.out.print(x); } }

A. True
B. False
C. Compilation Error
D. Runtime Error
Answer» B. False
1112.

Which of these class have only one field?

A. Character
B. Boolean
C. Byte
D. void
Answer» E.
1113.

Which of these methods is used to know whether a string contains “true”?

A. valueOf()
B. valueOfString()
C. getString()
D. none of the mentioned
Answer» B. valueOfString()
1114.

Which of these methods return string equivalent of Boolean object?

A. getString()
B. toString()
C. converString()
D. getStringObject()
Answer» C. converString()
1115.

Which of the following constant are defined in Boolean wrapper?

A. TRUE
B. FALSE
C. TYPE
D. All of the mentioned
Answer» E.
1116.

Which of these methods of Boolean wrapper returns boolean equivalent of an object.

A. getBool()
B. booleanValue()
C. getbooleanValue()
D. getboolValue()
Answer» C. getbooleanValue()
1117.

What is the output of this program? class Output { public static void main(String args[]) { char a = '@'; boolean x = Character.isLetter(a); System.out.print(x); } }

A. b
B. c
C. B
D. C
Answer» D. C
1118.

What is the output of this program? class Output { public static void main(String args[]) { char a = (char) 98; a = Character.toUpperCase(a); System.out.print(a); } }

A. b
B. c
C. B
D. C
Answer» D. C
1119.

What is the output of this program? class Output { public static void main(String args[]) { char a[] = {'a', '5', 'A', ' '}; System.out.print(Character.isDigit(a[0])+ " "); System.out.print(Character.isWhitespace(a[3])+ " "); System.out.print(Character.isUpperCase(a[2])); } }

A. true false true
B. false true true
C. true true false
D. false false false
Answer» C. true true false
1120.

What is the output of this program? class Output { public static void main(String args[]) { int a = Character.MIN_VALUE; System.out.print((char)a); } }

A. <
B. !
C. @
D. Space
Answer» E.
1121.

What is the output of this program? class Output { public static void main(String args[]) { int a = Character.MAX_VALUE; System.out.print((char)a); } }

A. <
B. >
C. ?
D. $
Answer» D. $
1122.

Which of these coding techniques is used by method isDefined()?

A. Latin
B. ASCII
C. ANSI
D. UNICODE
Answer» E.
1123.

Which of these methods is used to know whether a given Character object is part of Java’s Identifiers?

A. isIdentifier()
B. isJavaIdentifier()
C. isJavaIdentifierPart()
D. none of the mentioned
Answer» D. none of the mentioned
1124.

Which of these is a super class of Character wrapper?

A. Long
B. Digits
C. Float
D. Number
Answer» E.
1125.

Which of the following constant are defined in Character wrapper?

A. MAX_RADIX
B. MAX_VALUE
C. TYPE
D. All of the mentioned
Answer» E.
1126.

Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.

A. get()
B. getVhar()
C. charValue()
D. getCharacter()
Answer» D. getCharacter()
1127.

What is the output of this program? 1. class Output 2. { 3. public static void main(String args[]) 4. { 5. Double i = new Double(257.578123456789); 6. float x = i.floatValue(); 7. System.out.print(x); 8. } 9. }

A. 0
B. 257.0
C. 257.57812
D. 257.578123456789
Answer» D. 257.578123456789
1128.

What is the output of this program? 1. class Output 2. { 3. public static void main(String args[]) 4. { 5. Integer i = new Integer(257); 6. byte x = i.byteValue(); 7. System.out.print(x); 8. } 9. }

A. 0
B. 1
C. 256
D. 257
Answer» C. 256
1129.

What is the output of this program? 1. class Output 2. { 3. public static void main(String args[]) 4. { 5. Double i = new Double(257.5); 6. Double x = i.MIN_VALUE; 7. System.out.print(x); 8. } 9. }

A. 0
B. 4.9E-324
C. 1.7976931348623157E308
D. None of the mentioned
Answer» C. 1.7976931348623157E308
1130.

What is the output of this program? class Output { public static void main(String args[]) { Double i = new Double(257.5); Double x = i.MAX_VALUE; System.out.print(x); } }

A. 0
B. 1.7976931348623157E308
C. 1.7976931348623157E30
D. None of the mentioned
Answer» C. 1.7976931348623157E30
1131.

Which of these methods is not defined in both Byte and Short wrappers?

A. intValue()
B. isInfinite()
C. toString()
D. hashCode()
Answer» C. toString()
1132.

Which of these is a super class of wrappers Byte and short wrappers?

A. Long
B. Digits
C. Float
D. Number
Answer» E.
1133.

Which of the following methods Byte wrapper return the value as a double?

A. doubleValue()
B. converDouble()
C. getDouble()
D. getDoubleValue()
Answer» B. converDouble()
1134.

Which of these methods of Byte wrapper can be used to obtain Byte object from a string?

A. toString()
B. getString()
C. decode()
D. encode()
Answer» D. encode()
1135.

What is the output of this program? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.floor(x); System.out.print(y); } }

A. 0
B. 3
C. 3.0
D. 4
Answer» E.
1136.

What is the output of this program? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.ceil(x); System.out.print(y); } }

A. 0
B. 3
C. 3.0
D. 4
Answer» E.
1137.

What is the output of this program? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.abs(x); System.out.print(y); } }

A. 0
B. 3
C. 3.0
D. 3.1
Answer» C. 3.0
1138.

What is the output of this program? class A { int x; int y; void display() { System.out.print(x + " " + y); } } class Output { public static void main(String args[]) { A obj1 = new A(); A obj2 = new A(); obj1.x = 1; obj1.y = 2; obj2 = obj1.clone(); obj1.display(); obj2.display(); } }

A. 1 2 0 0
B. 1 2 1 2
C. 0 0 0 0
D. System Dependent
Answer» C. 0 0 0 0
1139.

Which of function return absolute value of a variable?

A. abs()
B. absolute()
C. absolutevariable()
D. none of the mentioned
Answer» B. absolute()
1140.

Which of these method return a largest whole number less than or equal to variable X?

A. double ceil(double X)
B. double floor(double X)
C. double max(double X)
D. double min(double X)
Answer» C. double max(double X)
1141.

Which of these method return a smallest whole number greater than or equal to variable X?

A. double ceil(double X)
B. double floor(double X)
C. double max(double X)
D. double min(double X)
Answer» B. double floor(double X)
1142.

Which of these class provides various types of rounding functions?

A. Math
B. Process
C. System
D. Object
Answer» B. Process
1143.

What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a = args.length; int b = 10 / a; System.out.print(a); try { if (a == 1) a = a / a - a; if (a == 2) { int c = {1}; c[8] = 9; } } catch (ArrayIndexOutOfBoundException e) { System.out.println("TypeA"); } catch (ArithmeticException e) { System.out.println("TypeB"); } } }

A. TypeA
B. TypeB
C. 0TypeA
D. 0TypeB
Answer» D. 0TypeB
1144.

What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a = 1; int b = 10 / a; try { if (a == 1) a = a / a - a; if (a == 2) { int c[] = {1}; c[8] = 9; } finally { System.out.print("A"); } } catch (NullPointerException e) { System.out.println("B"); } } }

A. A
B. B
C. AB
D. BA
Answer» D. BA
1145.

What is the output of this program? class exception_handling { static void throwexception() throws ArithmeticException { System.out.print("0"); throw new ArithmeticException ("Exception"); } public static void main(String args[]) { try { throwexception(); } catch (ArithmeticException e) { System.out.println("A"); } } }

A. A
B. 0
C. 0A
D. Exception
Answer» D. Exception
1146.

What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a[] = {1, 2,3 , 4, 5}; for (int i = 0; i < 5; ++i) System.out.print(a[i]); int x = 1/0; } catch(ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } } }

A. 12345
B. 12345A
C. 12345B
D. Compilation Error
Answer» E.
1147.

What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a[] = {1, 2,3 , 4, 5}; for (int i = 0; i < 7; ++i) System.out.print(a[i]); } catch(ArrayIndexOutOfBoundsException e) { System.out.print("0"); } } }

A. 12345
B. 123450
C. 1234500
D. Compilation Error
Answer» C. 1234500
1148.

Which of these class is used to create user defined exception?

A. java.lang
B. Exception
C. RunTime
D. System
Answer» C. RunTime
1149.

Which of these exceptions will be thrown if we use null reference for an arithmetic operation?

A. ArithmeticException
B. NullPointerException
C. IllegalAccessException
D. IllegalOperationException
Answer» C. IllegalAccessException
1150.

Which of these packages contain all the Java’s built in exceptions?

A. java.io
B. java.util
C. java.lang
D. java.net
Answer» D. java.net