Online Exam Quiz

questionQuestion  1 to 30

Which operator is considered to be with the highest precedence?

  • =
  • ==
  • ? :
  • ++
Mark for review

What will be the output of System.out.println(10 + 20 + "30");?

  • 3030
  • 102030
  • 30
  • 102030
Mark for review

Which class is used to read from a file in Java?

  • FileReader
  • FileWriter
  • BufferedWriter
  • PrintWriter
Mark for review

Which method is used to start a thread in Java?

  • run()
  • start()
  • init()
  • begin()
Mark for review

What is used to achieve multiple inheritance in Java?

  • Interfaces
  • Abstract classes
  • Both
  • None of the above
Mark for review

Which of these is an interface in the Collections Framework?

  • ArrayList
  • HashSet
  • LinkedList
  • Set
Mark for review

Which of the following is not a primitive data type in Java?

  • int
  • String
  • float
  • boolean
Mark for review

Which of the following is a valid long literal?

  • 0x99ffL
  • ABCDE
  • 0x99ff
  • 99ffL
Mark for review

How many times is the do while loop guaranteed to execute?

  • 0
  • 1
  • 2
  • infinite
Mark for review

Which keyword is used to inherit a class in Java?

  • extend
  • inherit
  • extends
  • implements
Mark for review

What is the use of the finalize() method?

  • To clean up resources
  • To start garbage collection
  • To end the program
  • None of the above
Mark for review

Which method is used to terminate a thread in Java?

  • stop()
  • terminate()
  • end()
  • interrupt()
Mark for review

What is the output of 10 + 20 + "30" in Java?

  • "3030"
  • "102030"
  • "30"
  • 60
Mark for review

Which of the following is a valid declaration of an array?

  • int[] arr;
  • int arr[];
  • int[] arr = new int[10];
  • All of the above
Mark for review

What is the purpose of the hashCode() method?

  • To compare two objects
  • To generate a unique integer for an object
  • To clone an object
  • To get the memory address of an object
Mark for review

Which method is called when an object is created in Java?

  • finalize()
  • init()
  • start()
  • constructor
Mark for review

Which method can be used to find the length of a string in Java?

  • getSize()
  • sizeOf()
  • lengthOf()
  • length()
Mark for review

Which of the following is not an access modifier in Java?

  • public
  • private
  • protected
  • default
Mark for review

What is the default value of a boolean variable in Java?

  • TRUE
  • FALSE
  • 0
  • 1
Mark for review

What is the return type of the hashCode() method in the Object class?

  • int
  • Object
  • long
  • void
Mark for review

Which of the following is true about inheritance in Java?

  • A class can inherit multiple classes
  • A class can implement multiple interfaces
  • A class can extend multiple interfaces
  • A class can implement multiple classes
Mark for review

What is a correct way to synchronize a method in Java?

  • synchronized void method()
  • synchronized(method)
  • sync void method()
  • void synchronized method()
Mark for review

Which of the following is a marker interface?

  • Serializable
  • Cloneable
  • Remote
  • All of the above
Mark for review

Which operator is used to create an object in Java?

  • new
  • create
  • object
  • instance
Mark for review

Which is the correct declaration of an abstract class?

  • abstract class MyClass {}
  • class abstract MyClass {}
  • MyClass abstract class {}
  • None of the above
Mark for review

Which of the following is a valid constructor of the String class?

  • String(String str)
  • String()
  • String(char[] charArray)
  • All of the above
Mark for review

Which of these are selection statements in Java?

  • if()
  • for()
  • continue
  • break()
Mark for review

What is the output of "Hello".concat("World") in Java?

  • Hello World
  • HelloWorld
  • Hello+World
  • Hello World!
Mark for review

Which of the following is not a valid declaration of a char?

  • char ch = 'A';
  • char ch = 65;
  • char ch = '\u0041';
  • char ch = "A";
Mark for review

Which package contains the Random class?

  • java.util
  • java.lang
  • java.io
  • java.net
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review