Itemp Java Quiz 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 Ekkoo
E
Ekkoo
Community Contributor
Quizzes Created: 4 | Total Attempts: 2,553
Questions: 6 | Attempts: 150

SettingsSettingsSettings
Itemp Java Quiz 2 - Quiz


Chapter 2 Revision


Questions and Answers
  • 1. 

    A Java source code can be created in  ______ .

    • A.

      MS Paint

    • B.

      NetBeans IDE

    • C.

      Photoshop

    • D.

      MS Excel

    Correct Answer
    B. NetBeans IDE
    Explanation
    NetBeans IDE is a popular integrated development environment (IDE) for Java programming. It provides tools and features that allow developers to create, edit, compile, and run Java source code. With NetBeans IDE, developers can easily write and manage their Java programs, making it a suitable choice for creating Java source code. MS Paint, Photoshop, and MS Excel are not suitable tools for creating Java source code as they are primarily used for image editing and spreadsheet tasks.

    Rate this question:

  • 2. 

    Which is the software you need to develop Java programs ?

    • A.

      JDK (Java Development Kit)

    • B.

      JRE (Java Runtime Environment)

    • C.

      Java API

    • D.

      JVM (Java Virtual Machine)

    Correct Answer
    A. JDK (Java Development Kit)
    Explanation
    JDK (Java Development Kit) is the correct answer because it is the software that provides the necessary tools and components to develop Java programs. It includes the Java compiler, debugger, and other development tools that are essential for writing, compiling, and running Java code. JRE (Java Runtime Environment) is used to run Java applications, but it does not include the tools needed for development. Java API is a library of prewritten classes and methods that developers can use in their programs. JVM (Java Virtual Machine) is the runtime environment in which Java programs are executed.

    Rate this question:

  • 3. 

    The _______ is used for compilation and the _______ is used for execution of the Java application.

    • A.

      Java compiler, Java interpreter

    • B.

      Java interpreter, Java executer

    • C.

      Java compiler, Debugger

    • D.

      Java compiler, Javadoc

    Correct Answer
    A. Java compiler, Java interpreter
    Explanation
    The Java compiler is used for compilation, which means it translates the Java source code into bytecode. The bytecode is then executed by the Java interpreter, which is responsible for translating the bytecode into machine code that can be understood and executed by the computer. Therefore, the Java compiler and Java interpreter are used for different stages of the Java application's lifecycle - compilation and execution respectively.

    Rate this question:

  • 4. 

    Which of the following declarations of the main method in a Java application is correct?

    • A.

      Public void main(String args)

    • B.

      Public static void main(String[ ] args)

    • C.

      Public static void main(string[ ] args)

    • D.

      Public void main()

    Correct Answer
    B. Public static void main(String[ ] args)
    Explanation
    The correct answer is "public static void main(String[ ] args)". In Java, the main method is the entry point for a Java application. It must be declared as public, static, and void. The parameter "String[ ] args" allows command-line arguments to be passed to the main method.

    Rate this question:

  • 5. 

    You are responsible for writing a new Java class, Employee, which will be used by several other classes in a large project. Select the correct way to declare the class, from the list below:

    • A.

      New class Employee

    • B.

      Protected class Employee

    • C.

      Private class Employee

    • D.

      Public class Employee

    Correct Answer
    D. Public class Employee
    Explanation
    The correct way to declare the class is "public class Employee". This is because the class needs to be accessible to other classes in the project, and using the "public" access modifier ensures that it can be accessed from anywhere within the project.

    Rate this question:

  • 6. 

    Which of the following is not a valid comment?

    • A.

      /** comment */

    • B.

      /* comment */

    • C.

      /* comment

    • D.

      // comment

    Correct Answer
    C. /* comment
    Explanation
    The answer is /* comment because it is missing the closing */ symbol, making it an invalid comment. The other options /** comment */, /* comment */, and // comment are all valid comments in different programming languages.

    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
  • Aug 20, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 19, 2011
    Quiz Created by
    Ekkoo
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.