

MCQOPTIONS
Saved Bookmarks
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.
1151. |
Which of these exceptions will be thrown if we declare an array with negative size? |
A. | IllegalArrayException |
B. | IllegalArraySizeExeption |
C. | NegativeArrayException |
D. | NegativeArraySizeExeption |
Answer» E. | |
1152. |
Which of these exceptions handles the situations when illegal argument is used to invoke a method? |
A. | IllegalException |
B. | Argument Exception |
C. | IllegalArgumentException |
D. | IllegalMethodArgumentExcepetion |
Answer» D. IllegalMethodArgumentExcepetion | |
1153. |
The same import package/class be called twice in java? |
A. | True |
B. | False |
Answer» B. False | |
1154. |
Where is String Pool stored? |
A. | Java Stack |
B. | Java Heap |
C. | Permanent Generation |
D. | Metaspace |
Answer» C. Permanent Generation | |
1155. |
Classes and Methods are stored in which space? |
A. | Eden space |
B. | Survivor space |
C. | Tenured space |
D. | Permanent space |
Answer» E. | |
1156. |
What is the java 8 update of PermGen? |
A. | Code Cache |
B. | Tenured Space |
C. | Metaspace |
D. | Eden space |
Answer» D. Eden space | |
1157. |
Which of the following is not a memory classification in java? |
A. | Young |
B. | Old |
C. | Permanent |
D. | Temporary |
Answer» E. | |
1158. |
Which class loader loads jar files from JDK directory? |
A. | Bootstrap |
B. | Extension |
C. | System |
D. | Heap |
Answer» C. System | |
1159. |
Which one of the following is a class loader? |
A. | Bootstrap |
B. | Compiler |
C. | Heap |
D. | Interpreter |
Answer» B. Compiler | |
1160. |
What is JVM? |
A. | Bootstrap |
B. | Interpreter |
C. | Extension |
D. | Compiler |
Answer» C. Extension | |
1161. |
Does code Segment loads the java code? |
A. | True |
B. | False |
Answer» B. False | |
1162. |
Which of the following is not a segment of memory in java? |
A. | Stack Segment |
B. | Heap Segment |
C. | Code Segment |
D. | Register Segment |
Answer» E. | |
1163. |
What is the output of this program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 1, 4); int i; int j; try { while ((i = input1.read()) == (j = input2.read())) { System.out.print((char)i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } |
A. | abc |
B. | abcd |
C. | abcde |
D. | None of the mentioned |
Answer» E. | |
1164. |
What is the output of this program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdef"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 0, 3); int i; try { while ((i = input2.read()) != -1) { System.out.print((char)i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } |
A. | abc |
B. | abcd |
C. | abcde |
D. | abcdef |
Answer» B. abcd | |
1165. |
What is the output of this program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdef"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0,length,c,0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 0, 3); int i; try { while ((i = input1.read()) != -1) { System.out.print((char)i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } |
A. | abc |
B. | abcd |
C. | abcde |
D. | abcdef |
Answer» E. | |
1166. |
Which of these classes can return more than one character to be returned to input stream? |
A. | BufferedReader |
B. | Bufferedwriter |
C. | PushbachReader |
D. | CharArrayReader |
Answer» D. CharArrayReader | |
1167. |
Which of these class can be used to implement input stream that uses a character array as the source? |
A. | BufferedReader |
B. | FileReader |
C. | CharArrayReader |
D. | FileArrayReader |
Answer» D. FileArrayReader | |
1168. |
Which of these method of FileReader class is used to read characters from a file? |
A. | read() |
B. | scanf() |
C. | get() |
D. | getInteger() |
Answer» B. scanf() | |
1169. |
Which of these class is used to read characters in a file? |
A. | FileReader |
B. | FileWriter |
C. | FileInputStream |
D. | InputStreamReader |
Answer» B. FileWriter | |
1170. |
Which of these stream contains the classes which can work on character stream? |
A. | InputStream |
B. | OutputStream |
C. | Character Stream |
D. | All of the mentioned |
Answer» D. All of the mentioned | |
1171. |
What is the output of this program? import java.io.*; public class filesinputoutput { public static void main(String[] args) { String obj = "abc"; byte b[] = obj.getBytes(); ByteArrayInputStream obj1 = new ByteArrayInputStream(b); for (int i = 0; i < 2; ++ i) { int c; while ((c = obj1.read()) != -1) { if (i == 0) { System.out.print(Character.toUpperCase((char)c)); obj2.write(1); } } System.out.print(obj2); } } } |
A. | AaBaCa |
B. | ABCaaa |
C. | AaaBaaCaa |
D. | AaBaaCaaa |
Answer» E. | |
1172. |
What is the output of this program? import java.io.*; public class filesinputoutput { public static void main(String[] args) { String obj = "abc"; byte b[] = obj.getBytes(); ByteArrayInputStream obj1 = new ByteArrayInputStream(b); for (int i = 0; i < 2; ++ i) { int c; while ((c = obj1.read()) != -1) { if (i == 0) { System.out.print(Character.toUpperCase((char)c)); } } } } } |
A. | abc |
B. | ABC |
C. | ab |
D. | AB |
Answer» C. ab | |
1173. |
What is the output of this program? import java.io.*; public class filesinputoutput { public static void main(String[] args) { String obj = "abc"; byte b[] = obj.getBytes(); ByteArrayInputStream obj1 = new ByteArrayInputStream(b); for (int i = 0; i < 2; ++ i) { int c; while ((c = obj1.read()) != -1) { if(i == 0) { System.out.print((char)c); } } } } } |
A. | abc |
B. | ABC |
C. | ab |
D. | AB |
Answer» B. ABC | |
1174. |
What is the output of this program? import java.io.*; class filesinputoutput { public static void main(String args[]) { InputStream obj = new FileInputStream("inputoutput.java"); System.out.print(obj.available()); } } |
A. | true |
B. | false |
C. | prints number of bytes in file |
D. | prints number of characters in the file |
Answer» D. prints number of characters in the file | |
1175. |
Which of these method(s) is/are used for writing bytes to an outputstream? |
A. | put() |
B. | print() and write() |
C. | printf() |
D. | write() and read() |
Answer» C. printf() | |
1176. |
Which of these is a method to clear all the data present in output buffers? |
A. | clear() |
B. | flush() |
C. | fflush() |
D. | close() |
Answer» C. fflush() | |
1177. |
Which of these data type is returned by every method of OutputStream? |
A. | int |
B. | float |
C. | byte |
D. | none of the mentioned |
Answer» E. | |
1178. |
Which of these method of InputStream is used to read integer representation of next available byte input? |
A. | read() |
B. | scanf() |
C. | get() |
D. | getInteger() |
Answer» B. scanf() | |
1179. |
Which of these class is used to read and write bytes in a file? |
A. | FileReader |
B. | FileWriter |
C. | FileInputStream |
D. | InputStreamReader |
Answer» D. InputStreamReader | |
1180. |
Which of these classes is used for input and output operation when working with bytes? |
A. | InputStream |
B. | Reader |
C. | Writer |
D. | All of the mentioned |
Answer» B. Reader | |
1181. |
What is the output of this program? import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.getName()); } } |
A. | java |
B. | system |
C. | java/system |
D. | /java/system |
Answer» C. java/system | |
1182. |
Which of these is method for testing whether the specified element is a file or a directory? |
A. | IsFile() |
B. | isFile() |
C. | Isfile() |
D. | isfile() |
Answer» C. Isfile() | |
1183. |
Which of these is specified by a File object? |
A. | a file in disk |
B. | directory path |
C. | directory in disk |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
1184. |
Which of these class is not related to input and output stream in terms of functioning? |
A. | File |
B. | Writer |
C. | InputStream |
D. | Reader |
Answer» B. Writer | |
1185. |
Which of these interface is not a member of java.io package? |
A. | DataInput |
B. | ObjectInput |
C. | ObjectFilter |
D. | FileFilter |
Answer» D. FileFilter | |
1186. |
Which of these class is not a member class of java.io package? |
A. | String |
B. | StringReader |
C. | Writer |
D. | File |
Answer» B. StringReader | |
1187. |
Which of these packages contain classes and interfaces used for input & output operations of a program? |
A. | java.util |
B. | java.lang |
C. | java.io |
D. | all of the mentioned |
Answer» D. all of the mentioned | |
1188. |
What is the output of this program? class Output { public static void main(String args[]) { Double y = new Double(257.57812); Double i = new Double(257.578123456789); try { int x = i.compareTo(y); System.out.print(x); } catch(ClassCastException e) { System.out.print("Exception"); } } } |
A. | 0 |
B. | 1 |
C. | Exception |
D. | None of the mentioned |
Answer» C. Exception | |
1189. |
What is the output of this program? class Output { public static void main(String args[]) { Double i = new Double(257.578123456789); float x = i.floatValue(); System.out.print(x); } } |
A. | 0 |
B. | 257.0 |
C. | 257.57812 |
D. | 257.578123456789 |
Answer» D. 257.578123456789 | |
1190. |
What is the output of this program? class Output { public static void main(String args[]) { Double i = new Double(257.578); int x = i.intValue(); System.out.print(x); } } |
A. | 0 |
B. | 1 |
C. | 256 |
D. | 257 |
Answer» E. | |
1191. |
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 | |
1192. |
What is the output of this program? class Output { public static void main(String args[]) { Double i = new Double(257.5); boolean x = i.isNaN(); System.out.print(x); } } |
A. | true |
B. | False |
C. | 0 |
D. | 1 |
Answer» C. 0 | |
1193. |
Which of these exceptions is thrown by compareTo() method defined in double wrapper? |
A. | IOException |
B. | SystemException |
C. | CastException |
D. | ClassCastException |
Answer» E. | |
1194. |
Which of these method of Double wrapper can be used to check whether a given value is infinite or not? |
A. | Infinite() |
B. | isInfinite() |
C. | checkInfinite() |
D. | None of the mentioned |
Answer» C. checkInfinite() | |
1195. |
Which of these methods can be used to check whether the given value is a number or not? |
A. | isNaN() |
B. | isNumber() |
C. | checkNaN() |
D. | checkNumber() |
Answer» B. isNumber() | |
1196. |
Which of the following methods return the value as a double? |
A. | doubleValue() |
B. | converDouble() |
C. | getDouble() |
D. | getDoubleValue() |
Answer» B. converDouble() | |
1197. |
Which of these is a super class of wrappers Double and Float? |
A. | Long |
B. | Digits |
C. | Float |
D. | Number |
Answer» E. | |
1198. |
What value will this program return to Java run-time system? import java.lang.System; class Output { public static void main(String args[]) { System.exit(5); } } |
A. | 0 |
B. | 1 |
C. | 4 |
D. | 5 |
Answer» E. | |
1199. |
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, 2, b, 3, a.length - 4); System.out.print(new String(a) + " " + new String(b)); } } |
A. | ABCDEF ABCDEF |
B. | ABCDEF GHIJKL |
C. | ABCDEF GHIABC |
D. | ABCDEF GHICDL |
Answer» E. | |
1200. |
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, 3, a.length - 3); System.out.print(new String(a) + " " + new String(b)); } } |
A. | ABCDEF ABCDEF |
B. | ABCDEF GHIJKL |
C. | ABCDEF GHIABC |
D. | GHIJKL GHIJKL |
Answer» D. GHIJKL GHIJKL | |