Online Exam Quiz

questionQuestion  1 to 30

Which of the following is not a valid access modifier in Java?

  • public
  • private
  • protected
  • package
Mark for review

Which of the following is not a valid method of the Math class in Java?

  • abs()
  • ceil()
  • floor()
  • round()
Mark for review

Which of these methods is a part of the Collection interface?

  • add()
  • size()
  • get()
  • isEmpty()
Mark for review

Which method is used to compare two strings in Java?

  • equals()
  • compare()
  • compareTo()
  • equalsIgnoreCase()
Mark for review

Which of the following is not a valid operator in Java?

  • +
  • -
  • *
  • **
Mark for review

Which of the following is used to create an object in Java?

  • new
  • create
  • object
  • instance
Mark for review

What is the extension of compiled Java classes?

  • .js
  • .txt
  • .class
  • .java
Mark for review

Which of the following is not a type of constructor in Java?

  • Default constructor
  • No-arg constructor
  • Parameterized constructor
  • Copy constructor
Mark for review

What is the size of an int variable in Java?

  • 4 bytes
  • 8 bytes
  • 2 bytes
  • 1 byte
Mark for review

Which of the following is used to create a strictfp method in Java?

  • strictfp
  • method
  • function
  • procedure
Mark for review

Which of the following is a reserved keyword in Java?

  • array
  • goto
  • null
  • constant
Mark for review

Which of the following is used to create a thread in Java?

  • Runnable interface
  • Thread class
  • Both A and B
  • None of the above
Mark for review

Which of these keywords is used to define interfaces in Java?

  • class
  • package
  • interface
  • implements
Mark for review

Which method is used to convert a string into a double in Java?

  • parseDouble()
  • valueOf()
  • convert()
  • toDouble()
Mark for review

Which of these data types is used to store text in Java?

  • int
  • float
  • char
  • String
Mark for review

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

  • length()
  • size()
  • getSize()
  • getLength()
Mark for review

Which of the following is used to handle exceptions in Java?

  • try-catch block
  • if-else statement
  • switch-case statement
  • for loop
Mark for review

Which of the following is used to create a final class in Java?

  • final
  • class
  • interface
  • extends
Mark for review

Which keyword is used to declare a constant in Java?

  • const
  • static
  • final
  • abstract
Mark for review

Which of the following statements is true about Java?

  • Java is a platform-independent language
  • Java is a procedural language
  • Java is a pure object-oriented language
  • Java supports both procedural and object-oriented programming
Mark for review

Which method must be implemented by all threads?

  • run()
  • start()
  • stop()
  • wait()
Mark for review

Which of the following is not a valid keyword in Java?

  • static
  • void
  • private
  • constant
Mark for review

Which of these is used to explain the type of exception that is thrown by a method?

  • throw
  • throws
  • thrown
  • exception
Mark for review

Which method is used to write bytes to an output stream?

  • read()
  • write()
  • print()
  • display()
Mark for review

Which of the following is not a valid method of the PriorityQueue class in Java?

  • add()
  • remove()
  • size()
  • length()
Mark for review

What is the superclass of all classes in Java?

  • java.lang.String
  • java.lang.Object
  • java.lang.System
  • java.lang.Class
Mark for review

What is the default encoding for an InputStreamReader?

  • UTF-8
  • ASCII
  • ISO-8859-1
  • UTF-16
Mark for review

What is the default value of the boolean data type in Java?

  • TRUE
  • FALSE
  • 0
  • null
Mark for review

In Java, what is the correct syntax to output "Hello World"?

  • System.out.println("Hello World");
  • print("Hello World");
  • echo("Hello World");
  • Console.WriteLine("Hello World");
Mark for review

Which method can be defined only once in a program?

  • main method
  • finalize method
  • static method
  • private method
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