Java Test 1

Java Test 1

10th Grade

15 Qs

quiz-placeholder

Similar activities

SDA uCertify Chapter 8 Mid-Chapter Quiz

SDA uCertify Chapter 8 Mid-Chapter Quiz

8th - 12th Grade

20 Qs

8.12 C++ Test on Classes

8.12 C++ Test on Classes

9th - 12th Grade

15 Qs

Kuis 1 Pretest

Kuis 1 Pretest

10th Grade

10 Qs

Classes & Objects

Classes & Objects

10th Grade

10 Qs

U2-String-Class-Objects

U2-String-Class-Objects

10th - 12th Grade

20 Qs

Computer Programming: Graphics

Computer Programming: Graphics

8th - 11th Grade

11 Qs

CICS Test 2 Review

CICS Test 2 Review

9th - 12th Grade

15 Qs

CodeHS 4.10 Key Terms for Classes

CodeHS 4.10 Key Terms for Classes

9th - 12th Grade

10 Qs

Java Test 1

Java Test 1

Assessment

Quiz

Computers

10th Grade

Medium

Created by

Vikas Bandaru

Used 5+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to declare an instance variable in Java?
public static int myVariable;
static public int myVariable;
int myVariable;
protected int myVariable;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a constructor in Java?
To define a variable
To create a new class
To call a method
To initialize instance variables

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a class and an object in Java?
A class is a blueprint for an object, while an object is an instance of a class.
A class is a data type, while an object is a variable.
A class contains variables and methods, while an object contains only variables.
A class can have multiple instances, while an object is a single instance of a class.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to define a setter method in Java?
public void setMyVariable();
public setMyVariable(int value);
public void setMyVariable(int value) { myVariable = value; }
All of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct syntax for a single-line comment in Java?
/*This is a comment*/
This is a comment//
// This is a comment
# This is a comment

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a getter method in Java?
To get the value of a variable
To set the value of a variable
To create a new object
All of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to declare a class in Java?

public MyClass { // code block }

class public MyClass() { // code block }

public class MyClass { // code block }

None of the above

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?