Search Header Logo

Java Programming Quiz

Authored by Fidaa Abed

Computers

12th Grade

Used 4+ times

Java Programming Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What keyword is used to declare instance variables private in Java?

public

protected

private

static

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which naming convention is followed for class names in Java?

Pascal Case

Snake Case

Camel Case

Kebab Case

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default initial value for a String instance variable in Java?

Empty String

0

null

undefined

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following describes a local variable in Java?

It exists only within a method

It is accessible to all classes

It is initialized by default

It is declared outside of methods

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to create an object in Java?

make

new

create

object

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to set the name of an object in the Account class example?

getName

setName

assignName

setAccountName

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if a method has a local variable with the same name as an instance variable?

Compilation error

Method will use the instance variable

Method will use the local variable

An exception will be thrown

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?