Java Data Types and String Manipulation

Java Data Types and String Manipulation

12th Grade

20 Qs

quiz-placeholder

Similar activities

Coding Unit 2 Review

Coding Unit 2 Review

9th - 12th Grade

18 Qs

AP Computer Science A Quiz

AP Computer Science A Quiz

12th Grade

15 Qs

Fun with JavaScript #1

Fun with JavaScript #1

9th - 12th Grade

15 Qs

Data Type

Data Type

7th - 12th Grade

20 Qs

Progamming - Java Syntax

Progamming - Java Syntax

11th - 12th Grade

15 Qs

JavaScript_2

JavaScript_2

12th Grade

22 Qs

Principles of Computer Science

Principles of Computer Science

10th - 12th Grade

20 Qs

Code.org: AP CSA U3, Lessons 1-6 Review

Code.org: AP CSA U3, Lessons 1-6 Review

11th - 12th Grade

20 Qs

Java Data Types and String Manipulation

Java Data Types and String Manipulation

Assessment

Quiz

Computers

12th Grade

Medium

Created by

JAYA SUDIKSHA

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What are the four main primitive data types in Java?

char, int, long, object

int, boolean, char, double

int, float, boolean, string

float, string, byte, short

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How do you declare a variable in Java?

variableName dataType;

dataType: variableName;

var variableName;

dataType variableName;

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the default value of a boolean variable in Java?

true

false

null

1

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Explain the difference between 'int' and 'Integer' in Java.

'int' can hold null values; 'Integer' cannot.

'int' is a reference type; 'Integer' is a primitive type.

Both 'int' and 'Integer' are the same and interchangeable.

'int' is a primitive type; 'Integer' is a wrapper class.

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the purpose of the 'final' keyword when declaring a variable?

The 'final' keyword is used to declare a variable that can hold multiple data types.

The 'final' keyword allows a variable to be reassigned multiple times.

The 'final' keyword makes a variable accessible only within its own method.

The 'final' keyword makes a variable immutable, preventing it from being reassigned after its initial assignment.

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of the following code: int x = 5; System.out.println(x++);?

4

6

5

5.0

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the scope of a variable declared inside a method?

Static scope limited to the class.

Local scope within the method only.

Global scope accessible throughout the program.

Block scope only within the nearest curly braces.

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?