![placeholder image to represent content](/_next/image?url=%2Fassets%2Fquiz_default_logo.jpg&w=256&q=75)
Introduction to Java: Quiz 2
Quiz by Kushal Verma
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
15 questions
Show answers
- Q1Which of these classes are the direct subclasses of the Throwable class?Error and Exception classIOException and VirtualMachineError classException and VirtualMachineError classRuntimeException and Error class45s
- Q2Which of these keywords must be used to handle the exception thrown by try block in some rational manner?throwscatchthrowfinally30s
- Q3File class is included in which package?java.langjava.netjava.iojava.util45s
- Q4Given the code: String s1 = ”yes” ; String s2 = ”yes” ; String s3 = new String (s1); Which of the following would equate to true?s1 == s3Compilation Errors1 == s3s1 == s245s
- Q5What type of Exceptions can NOT be ignored at compile time?ErrorChecked ExceptionsUncompiled ExceptionsUnchecked Exceptions45s
- Q6java.lang.NullPointerException is aRuntime ExceptionNone of the givenCompile time ExceptionError45s
- Q7Which of these will be invalid declaration?try-finally blocktry-catch-finally blockcatch-finally blocktry-catch block45s
- Q8Which of the statement is not true about String in java?String is case sensitive in Java.String class is defined in java.util package.String is thread-safe in Java.String is immutable in Java.45s
- Q9Which of these class is used to read bytes from a file?FileInputStreamOutputReaderFileWriterFileReader45s
- Q10Which of these class is used to write characters in a file?FileOutputFileOutputStreamStreamWriterFileWriter45s
- Q11Which of these methods are used to read in from file?read()scan()get()readFileInput()45s
- Q12Which of these exception is thrown in cases when the file specified for reading is not found?FileInputExceptionFileNotFoundExceptionFileExceptionNullPointerException45s
- Q13Which are the special symbols used to declare an array in Java?[]<>{}()45s
- Q14What is the output of the below Java program? int[] marks = {35,65,95}; System.out.print(marks.length + "," + marks[1]);2,653,652,353,3545s
- Q15What is the output of the below Java code snippet? int[] buckets = {}; System.out.print(buckets.length);Compiler error01-145s