placeholder image to represent content

JAVA QUIZ 2

Quiz by Namasivayam M

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
20 questions
Show answers
  • Q1
    To prevent any method from overriding, we declare the method as
    friend
    abstract
    static
    final
    30s
  • Q2
    Which 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
  • Q3
    Which of the following is true
    A 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 Above
    30s
  • Q4
    A constructor
    May be declared private
    All are Correct
    Is used to create objects.
    Must have the same name as the class it is declared within.
    30s
  • Q5
    What is the bytecode in the context of JAVA
    It is another name for a Java source file.
    It is the code written within the instance methods of a class
    The type of code generated by a Java compiler.
    The type of code generated by a Java Virtual Machine.
    30s
  • Q6
    In java, objects are passed as
    Method called call by value
    Constructor
    Memory address
    Copy of that object
    30s
  • Q7
    public 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"); } }
    HAI
    JAVA
    WELCOME
    HAIWELCOME
    30s
  • Q8
    In Java, a character constant’s value is its integer value in the ………………………character set.
    BCD
    Unicode
    Binary
    ASCII
    30s
  • Q9
    Which feature comes under compile time polymorphism
    C. Method overriding
    Both A and B
    A. Method overloading
    B. Constructor overloading
    30s
  • Q10
    Which is the right naming convention for method in Java?
    void DrawShape()
    All
    void drawShape()
    void draw_shape()
    30s
  • Q11
    Which of these cannot be declared static?
    Variable
    Class
    Object
    Method
    30s
  • Q12
    An anonymous class in Java is
    A type of inner class without a name
    A class without a definition
    Base Class
    An abstract class
    30s
  • Q13
    ArrayList list = new ArrayList<>(); list.add("Java"); list.add("Python"); System.out.println(list.remove(0));
    Python
    Java
    Compilation Error
    TRUE
    30s
  • Q14
    Which of the following keywords is used to prevent inheritance
    final
    catch
    extends
    super
    30s
  • Q15
    import 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 Error
    30s

Teachers give this quiz to your class