Classes - Static and Instance

Classes - Static and Instance

10th - 12th Grade

16 Qs

quiz-placeholder

Similar activities

Java Writing Classes Unit 5 Quiz

Java Writing Classes Unit 5 Quiz

AP CS A Vocab Review

AP CS A Vocab Review

AP CS Final Exam

AP CS Final Exam

CompSci A Unit 5: Classes and Objects

CompSci A Unit 5: Classes and Objects

Java Class Definitions

Java Class Definitions

Java Classes and Object-Oriented Programming Quiz

Java Classes and Object-Oriented Programming Quiz

Java Review 1

Java Review 1

Understanding Java Instance Variables

Understanding Java Instance Variables

Classes - Static and Instance

Classes - Static and Instance

Assessment

Quiz

Computers

10th - 12th Grade

Hard

Created by

Jesse Victoroff

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Math.random() is an example of a static method

True

False

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is true about this code running in a client program?

This code will not compile no matter what

This code will compile no matter what

This code will only compile if printIdNum is an instance method

This code will only compile if printIdNum is a static method

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between "static" and "instance"?

Static items belong to the object, instance items belong to the class

Static items belong to the class, instance items belong to the object

Static refers to variables, instance refers to methods

Static refers to methods, instance refers to variables

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is TRUE about instance variables

They can be accessed from within a class without an accessor method

They can be accessed from outside a class without an accessor method

You must both declare and instantiate them before your constructor

They must be public

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is NOT true about default constructors

Java will create a default Constructor if you forget to write one

A default constructor cannot use negative numbers

A default constructor cannot have parameters

A default constructor cannot have a return type

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the "new" keyword do?

Create a new spot in memory for a class data type

Create a new spot in memory for a primitive data type

Declare a new variable

Initialize a new variable

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does a constructor do?

Create a new spot in memory for a class data type

Declare instance variables

Initialize the values of the instance variables

Create a new class

Create a free account and access millions of resources

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?

Discover more resources for Computers