Search Header Logo

Classes - Static and Instance

Authored by Jesse Victoroff

Computers

10th - 12th Grade

Used 1+ times

Classes - Static and Instance
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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

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?