Search Header Logo

Java Programming midterm exam

Authored by Bryan Cajurao

Other

University

Used 4+ times

Java Programming midterm exam
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

24 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

What defines a class in a Java program?

public static void main(String[] args)

public class HelloWorld

System.out.println()

import java.util.Scanner

2.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

What symbol is used to terminate a Java statement?

Colon (:)

Semicolon (;)

Comma (,)

Period (.)

3.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

What is the starting point of any Java program?

The first line of the file

The main method

The class declaration

The import statement

4.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

Which of the following is used to denote the beginning and end of a block in Java?

Parentheses ()

Square brackets []

Curly braces {}

Angle brackets <>

5.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

What is the purpose of the public keyword in a class declaration?

It makes the class accessible to other classes from other packages.

It restricts the class to the same package.

It prevents the class from being instantiated.

It makes the class immutable.

6.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

Which of the following is NOT a type of Java comment?

Single-line (//)

Multi-line (/* */)

Javadoc (/** */)

Inline (#)

7.

MULTIPLE CHOICE QUESTION

3 mins • 2 pts

What is the correct way to write a single-line comment in Java?

/* This is a comment */

// This is a comment

# This is a comment

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?