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.

1201.

What is the output of this program? import java.lang.System; class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 0, b, 0, a.length); System.out.print(new String(a) + " " + new String(b)); } }

A. ABCDEF ABCDEF
B. ABCDEF GHIJKL
C. GHIJKL ABCDEF
D. GHIJKL GHIJKL
Answer» B. ABCDEF GHIJKL
1202.

What is the output of this program? import java.lang.System; class Output { public static void main(String args[]) { long start, end; start = System.currentTimeMillis(); for (int i = 0; i < 10000000; i++); end = System.currentTimeMillis(); System.out.print(end - start); } }

A. 0
B. 1
C. 1000
D. System Dependent
Answer» E.
1203.

Which of these values are returns under the case of normal termination of a program?

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

Which of these method can set the out stream to OutputStream?

A. setStream()
B. setosteam()
C. setOut()
D. streamtoOstream()
Answer» D. streamtoOstream()
1205.

Which of these methods loads the specified dynamic library?

A. load()
B. library()
C. loadlib()
D. loadlibrary()
Answer» B. library()
1206.

Which of these methods initiates garbage collection?

A. gc()
B. garbage()
C. garbagecollection()
D. Systemgarbagecollection()
Answer» B. garbage()
1207.

Which of these exceptions is thrown by methods of System class?

A. IOException
B. SystemException
C. SecurityException
D. InputOutputException
Answer» D. InputOutputException
1208.

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

A. 2.0
B. 4.0
C. 8.0
D. 9.0
Answer» D. 9.0
1209.

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

A. true
B. flase
C. 3.1
D. 4.5
Answer» E.
1210.

What is the output of this program? class Output { public static void main(String args[]) { int 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
1211.

What is the value of “d” after this line of code has been executed? double d = Math.round ( 2.5 + Math.random() );

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

Which of these class encapsulate the run time state of an object or an interface?

A. Class
B. Object
C. Runtime
D. System
Answer» B. Object
1213.

Which of these class contains only floating point functions?

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

Which of these method is a rounding function of Math class?

A. max()
B. min()
C. abs()
D. all of the mentioned
Answer» E.
1215.

What is the value of double consonant ‘E’ defined in Math class?

A. approximately 3
B. approximately 3.14
C. approximately 2.72
D. approximately 0
Answer» D. approximately 0
1216.

Which of these method of Object class can generate duplicate copy of the object on which it is called?

A. clone()
B. copy()
C. duplicate()
D. dito()
Answer» B. copy()
1217.

Which of these class is superclass of all other classes?

A. Math
B. Process
C. System
D. Object
Answer» E.
1218.

What is the output of this program? class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 1, b, 3, 0); System.out.print(new String(a) + " " + new String(b)); } }

A. ABCDEF GHIJKL
B. ABCDEF GCDEFL
C. GHIJKL ABCDEF
D. GCDEFL GHIJKL
Answer» B. ABCDEF GCDEFL
1219.

What is the output of this program? class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 2, b, 1, a.length-2); System.out.print(new String(a) + " " + new String(b)); } }

A. ABCDEF GHIJKL
B. ABCDEF GCDEFL
C. GHIJKL ABCDEF
D. GCDEFL GHIJKL
Answer» C. GHIJKL ABCDEF
1220.

What is the output of this program? class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a , 0, b, 0, a.length); System.out.print(new String(a) + " " + new String(b)); } }

A. ABCDEF ABCDEF
B. ABCDEF GHIJKL
C. GHIJKL ABCDEF
D. GHIJKL GHIJKL
Answer» B. ABCDEF GHIJKL
1221.

What is the output of this program? class Output { public static void main(String args[]) { long start, end; start = System.currentTimeMillis(); for (int i = 0; i < 10000000; i++); end = System.currentTimeMillis(); System.out.print(end - start); } }

A. 0
B. 1
C. 100
D. System Dependent
Answer» E.
1222.

Which of these class holds a collection of static methods and variables?

A. Void
B. Process
C. Runtime
D. System
Answer» E.
1223.

Which of the following is method of System class is used to find how long a program takes to execute?

A. currenttime()
B. currentTime()
C. currentTimeMillis()
D. currenttimeMillis()
Answer» D. currenttimeMillis()
1224.

Which of these class can encapsulate an entire executing program?

A. Void
B. Process
C. Runtime
D. System
Answer» C. Runtime
1225.

Standard output variable ‘out’ is defined in which class?

A. Void
B. Process
C. Runtime
D. System
Answer» E.
1226.

Which of the following method of Process class can terminate a process?

A. void kill()
B. void destroy()
C. void terminate()
D. void exit()
Answer» C. void terminate()
1227.

Which of these class have only one field ‘TYPE’?

A. Void
B. Process
C. System
D. Runtime
Answer» B. Process
1228.

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

A. 256
B. 256.0
C. 256.00
D. 257.00
Answer» B. 256.0
1229.

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

A. 0
B. 1
C. 257
D. 257.0
Answer» E.
1230.

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

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

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
1232.

Which of these methods is used to obtain value of invoking object as a long?

A. long value()
B. long longValue()
C. Long longvalue()
D. Long Longvalue()
Answer» C. Long longvalue()
1233.

Which of the following is method of wrapper Integer for converting the value of an object into int?

A. bytevalue()
B. int intValue();
C. Bytevalue()
D. Byte Bytevalue()
Answer» C. Bytevalue()
1234.

Which of these is wrapper for simple data type char?

A. Float
B. Character
C. String
D. Integer
Answer» C. String
1235.

Which of these is a super class of wrappers Long, Character & Integer?

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

Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?

A. int hash()
B. int hashcode()
C. int hashCode()
D. Integer hashcode()
Answer» D. Integer hashcode()
1237.

Which of these is a wrapper for data type int?

A. Integer
B. Long
C. Byte
D. Double
Answer» B. Long
1238.

What is the output of this program? class binary { public static void main(String args[]) { int num = 17; System.out.print(Integer.toBinaryString(num)); } }

A. 1001c
B. 10011
C. 11011
D. 10001
Answer» E.
1239.

What is the output of this program? class isNaN_output { public static void main(String args[]) { Double d = new Double(1 / 0.); boolean x = d.isNaN(); System.out.print(x); } }

A. 0
B. 1
C. True
D. False
Answer» E.
1240.

What is the output of this program? class isinfinite_output { public static void main(String args[]) { Double d = new Double(1 / 0.); boolean x = d.isInfinite(); System.out.print(x); } }

A. 0
B. 1
C. True
D. False
Answer» D. False
1241.

Which of the following package stores all the simple data types in java?

A. lang
B. java
C. util
D. java.packages
Answer» B. java
1242.

Which of these methods is used to check for infinitely large and small values?

A. isInfinite()
B. isNaN()
C. Isinfinite()
D. IsNaN()
Answer» B. isNaN()
1243.

Which of the following is method of wrapper Float for converting the value of an object into byte?

A. bytevalue()
B. byte byteValue()
C. Bytevalue()
D. Byte Bytevalue().
Answer» C. Bytevalue()
1244.

Which of these is wrapper for simple data type float?

A. float
B. double
C. Float
D. Double
Answer» D. Double
1245.

Which of these is a super class of wrappers Double & Integer?

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

Which of these is a process of converting a simple data type into a class?

A. type wrapping
B. type conversion
C. type casting
D. none of the Mentioned.
Answer» B. type conversion
1247.

Which of these classes is not included in java.lang?

A. Byte
B. Integer
C. Array
D. Class
Answer» D. Class
1248.

What is the output of this program? class output { public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Hello"); s1.insert(1,"Java"); System.out.println(s1); } }

A. hello
B. Java
C. Hello Java
D. HelloJava
Answer» E.
1249.

What is the output of this program? class output { public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Hello World"); s1.insert(6 , "Good "); System.out.println(s1); } }

A. HelloGoodWorld
B. HellGoodoWorld
C. HellGood oWorld
D. Hello Good World
Answer» E.
1250.

What is the output of this program? class output { public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Hello"); s1.setCharAt(1,'x'); System.out.println(s1); } }

A. xello
B. xxxxx
C. Hxllo
D. Hexlo
Answer» D. Hexlo