JAVA QUIZ 2
Quiz by Namasivayam M
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
20 questions
Show answers
- Q1To prevent any method from overriding, we declare the method asfriendabstractstaticfinal30s
- Q2Which statement is not true in java language?A private member of a class cannot be accessed from its derived class.A private member of a class cannot be accessed by the methods of the same class.A public member of a class can be accessed in all the packages.A protected member of a class can be accessed from its derived class.30s
- Q3Which of the following is trueA finally block is executed, only if an exception occurs.A finally block always executes, regardless of whether an exception is thrown.A finally block is executed before the catch block but after the try block.None of the Above30s
- Q4A constructorMay be declared privateAll are CorrectIs used to create objects.Must have the same name as the class it is declared within.30s
- Q5What is the bytecode in the context of JAVAIt is another name for a Java source file.It is the code written within the instance methods of a classThe type of code generated by a Java compiler.The type of code generated by a Java Virtual Machine.30s
- Q6In java, objects are passed asMethod called call by valueConstructorMemory addressCopy of that object30s
- Q7public static void main(String args[]) { int a=2, b=3; if (a==3) if (b==3) System.out.println("HAI"); else System.out.println("WELCOME"); System.out.println("JAVA"); } }HAIJAVAWELCOMEHAIWELCOME30s
- Q8In Java, a character constant’s value is its integer value in the ………………………character set.BCDUnicodeBinaryASCII30s
- Q9Which feature comes under compile time polymorphismC. Method overridingBoth A and BA. Method overloadingB. Constructor overloading30s
- Q10Which is the right naming convention for method in Java?void DrawShape()Allvoid drawShape()void draw_shape()30s
- Q11Which of these cannot be declared static?VariableClassObjectMethod30s
- Q12An anonymous class in Java isA type of inner class without a nameA class without a definitionBase ClassAn abstract class30s
- Q13ArrayList
list = new ArrayList<>(); list.add("Java"); list.add("Python"); System.out.println(list.remove(0)); PythonJavaCompilation ErrorTRUE30s - Q14Which of the following keywords is used to prevent inheritancefinalcatchextendssuper30s
- Q15import java.util.*; class Test { public static void main(String[] args) { ArrayList al = new ArrayList
(); al.add("A"); al.add(10); al.add(10.5); al.add(true); System.out.println(al); } } Compile successfully, but Exception raised at Runtime[A, 10, 10.5, true][A]Compilation Error30s