Java Programming - Level 2

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Rushikesh
R
Rushikesh
Community Contributor
Quizzes Created: 4 | Total Attempts: 4,027
Questions: 20 | Attempts: 356

SettingsSettingsSettings
Java Programming - Level 2 - Quiz

Grab your Java programming excellence certificate only on https://javasimplify. Blogspot. Com.
Terms and conditions to get your certificate:
1. You have to attend all questions to pass this exam
2. Need Minimum 60% aggregate to pass this quiz.
3. Must have 50% marks to get your verified certificate of java programming level 2 test
4. You will get your certificate immediately from Java simplified once you finished the test with passing criteria.


Questions and Answers
  • 1. 

    What is the range of byte data type in Java?

    • A.

      -128 to 127

    • B.

      -32768 to 32767

    • C.

      -2147483648 to 2147483647

    • D.

      None of the mentioned

    Correct Answer
    A. -128 to 127
    Explanation
    Explanation: Byte occupies 8 bits in memory. Its range is from -128 to 127.

    Rate this question:

  • 2. 

    Which of these coding types ​are used for data type characters in Java?​

    • A.

      ASCII

    • B.

      ISO-LATIN- 1

    • C.

      UNICODE

    • D.

      None of the mentioned

    Correct Answer
    C. UNICODE
    Explanation
    Explanation: Unicode defines fully international character set that can represent all the characters found in all human languages. Its range is from 0 to 65536.

    Rate this question:

  • 3. 

    Literals in java must be appended ​to which of these?​

    • A.

      L

    • B.

      I

    • C.

      D

    • D.

      L and I

    Correct Answer
    D. L and I
    Explanation
    Explanation: Data type long literals are appended by an upper or lowercase L.

    Rate this question:

  • 4. 

     What is the prototype of the default constructor of this class?

    • A.

      Prototype( )

    • B.

      Prototype(void)

    • C.

      Public prototype(void)

    • D.

      Public prototype( )

    Correct Answer
    D. Public prototype( )
    Explanation
    The correct answer is "public prototype( )". This is the prototype of the default constructor of the class. The "public" keyword indicates that the constructor is accessible from any other class. The "prototype" keyword is the name of the constructor, and the empty parentheses indicate that it does not take any parameters.

    Rate this question:

  • 5. 

    Which of these is an incorrect array declaration?

    • A.

      Int arr[] = new int[5]

    • B.

      int [] arr = new int[5]

    • C.

      Int arr[] = new int[5]

    • D.

      Int arr[] = int [5] new

    Correct Answer
    D. Int arr[] = int [5] new
    Explanation
    Explanation: Operator new must be succeeded by array type and array size.

    Rate this question:

  • 6. 

    With x = 0, which of the following are legal lines of Java code for changing the value of x to1?
    1. x++;
    2. x = x + 1;
    3. x += 1;
    4. x =+ 1;

    • A.

      1, 2, & 3

    • B.

      1 & 4

    • C.

      1, 2, 3 & 4

    • D.

      3 & 2

    Correct Answer
    C. 1, 2, 3 & 4
    Explanation
    Operator ++ increases value of variable by 1. x = x + 1 can also be written in shorthand form as x += 1. Also x =+ 1 will set the value of x to 1.

    Rate this question:

  • 7. 

    Which operator is used to invert all the digits in​ the binary representation of a number?

    • A.

      ~

    • B.

    • C.

      >>>

    • D.

      ^

    Correct Answer
    A. ~
    Explanation
    Explanation: Unary not operator, ~, inverts all of the bits of its operand in binary representation.

    Rate this question:

  • 8. 

    Which of these is returned by “greater than”, “less than” and “equal to” operators?

    • A.

      Iterator

    • B.

      Floating - point numbers

    • C.

      Boolean

    • D.

      None of the mentioned

    Correct Answer
    C. Boolean
    Explanation
    Explanation: All relational operators return a boolean value ie. true and false.

    Rate this question:

  • 9. 

    What should be expression1 evaluate to in using​ the ternary operator as in this ​​ expression1 ? expression2 : expression3line?​ 

    • A.

      Integer

    • B.

      Floating - point numbers

    • C.

      Boolean

    • D.

      None of the mentioned

    Correct Answer
    C. Boolean
    Explanation
    Explanation: The controlling condition of ternary operator must evaluate to boolean.

    Rate this question:

  • 10. 

    Which keyword is used by​ the method to refer to the object that invoked it?​

    • A.

      Import

    • B.

      Catch

    • C.

      Abstract

    • D.

      This

    Correct Answer
    D. This
    Explanation
    Explanation: this keyword can be used inside any method to refer to the current object. this is always a reference to the object on which the method was invoked.

    Rate this question:

  • 11. 

    Which of this keyword is used to make a class?

    • A.

      Class

    • B.

      Struct

    • C.

      Int

    • D.

      None of the mentioned

    Correct Answer
    A. Class
    Explanation
    The keyword "class" is used to make a class in programming. A class is a blueprint or template for creating objects, and it defines the properties and behaviors that an object of that class will have. In many programming languages, including Python, "class" is the keyword used to define a new class. Therefore, the correct answer is "class".

    Rate this question:

  • 12. 

    Which of these can be overloaded?

    • A.

      Methods

    • B.

      Constructors

    • C.

      All of the mentioned

    • D.

      None of the mentioned

    Correct Answer
    C. All of the mentioned
    Explanation
    In object-oriented programming, overloading refers to the ability to define multiple methods or constructors with the same name but different parameters. This allows for flexibility and convenience when working with different data types or varying numbers of arguments. Therefore, both methods and constructors can be overloaded. By overloading methods or constructors, developers can create more versatile and reusable code.

    Rate this question:

  • 13. 

    Which of these is used to access ​member of class before the object of that class is created?

    • A.

      Public

    • B.

      Private

    • C.

      Static

    • D.

      Protected

    Correct Answer
    C. Static
    Explanation
    The keyword "static" is used to access members of a class before an object of that class is created. Static members belong to the class itself rather than to any specific instance of the class. They can be accessed using the class name followed by the member name, without the need for an object to be created. This allows for the use of class variables and methods without the need to instantiate an object of the class.

    Rate this question:

  • 14. 

    Which of these keywords is used to prevent content of a variable from being modified?

    • A.

      Final

    • B.

      Last

    • C.

      Constant

    • D.

      Static

    Correct Answer
    A. Final
    Explanation
    Explanation: A variable can be declared final, doing so prevents its content from being modified. Final variables must be initialized when it is declared.

    Rate this question:

  • 15. 

    Which of ​this method of String class is used to obtain character at specified index?

    • A.

      Char()

    • B.

      Charat()

    • C.

      Charat()

    • D.

      CharAt()

    Correct Answer
    D. CharAt()
    Explanation
    The correct answer is charAt(). The charAt() method is used to obtain the character at a specified index in a String. It takes an index as a parameter and returns the character at that index.

    Rate this question:

  • 16. 

    Which of these operators can be used to concatenate two or more String objects?

    • A.

      +

    • B.

      +=

    • C.

      &

    • D.

      ||

    Correct Answer
    A. +
    Explanation
    Explanation: operator + is used to concatenate strings, Example String s = “i ” + “like ” + “java”; String s contains “I like java”.

    Rate this question:

  • 17. 

    Which of these is a mechanism for naming and visibility control of a class and its content?

    • A.

      Object

    • B.

      Packages

    • C.

      Interfaces

    • D.

      None of the Mentioned

    Correct Answer
    B. Packages
    Explanation
    Explanation: Packages are both naming and visibility control mechanism. We can define a class inside a package which is not accessible by code outside the package.

    Rate this question:

  • 18. 

    Which of these process occur automatically by java ​runtime system?

    • A.

      Serialization

    • B.

      Garbage collection

    • C.

      File Filtering

    • D.

      All of the mentioned

    Correct Answer
    A. Serialization
    Explanation
    Serialization and deserialization occur automatically by java runtime system, Garbage collection also occur automatically but is done by CPU or the operating system not by the java runtime system.

    Rate this question:

  • 19. 

    Which of ​this interface is implemented by Thread class?

    • A.

      Runnable

    • B.

      Connections

    • C.

      Set

    • D.

      MapConnections

    Correct Answer
    A. Runnable
    Explanation
    The correct answer is Runnable. The Thread class in Java implements the Runnable interface. This interface provides a way to define a task that can be executed concurrently by multiple threads. The Runnable interface has a single method called run(), which contains the code that will be executed when the thread is started. By implementing the Runnable interface, the Thread class can be used to create and control threads in Java.

    Rate this question:

  • 20. 

    What does AWT ​stand for?

    • A.

      All Window Tools

    • B.

      All Writing Tools

    • C.

      Abstract Window Toolkit

    • D.

      Abstract Writing Toolkit

    Correct Answer
    C. Abstract Window Toolkit
    Explanation
    Explanation: AWT stands for Abstract Window Toolkit, it is used by applets to interact with the user.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 18, 2017
    Quiz Created by
    Rushikesh
Back to Top Back to top
Advertisement