Do you know some Java basics?

Do you know some Java basics?

9th - 12th Grade

14 Qs

quiz-placeholder

Similar activities

Python Basics - Year 8

Python Basics - Year 8

7th - 9th Grade

14 Qs

Python Print Statement

Python Print Statement

6th - 10th Grade

12 Qs

ocr computer science 2.5

ocr computer science 2.5

10th Grade

16 Qs

Introduction to programming

Introduction to programming

12th Grade

12 Qs

Unit 1. Introduction to Object-Oriented Programming Concepts

Unit 1. Introduction to Object-Oriented Programming Concepts

9th - 10th Grade

15 Qs

Classification of programming languages

Classification of programming languages

10th Grade

10 Qs

Computer Languages

Computer Languages

KG - University

10 Qs

Computer

Computer

10th Grade

15 Qs

Do you know some Java basics?

Do you know some Java basics?

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

Dior R. Nguyen (GCC Instructor)

Used 3+ times

FREE Resource

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which statement is true about Java?

Java is a sequence-dependent programming language

Java is a code dependent programming language

Java is a platform-dependent programming language

Java is a platform-independent programming language

Answer explanation

Java is called ‘Platform Independent Language’ as it primarily works on the principle of ‘compile once, run everywhere’.

2.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which of these cannot be used for a variable name in Java?

Identifier & keywords

Identifier

Keywords

None of the above

Answer explanation

Keywords are specially reserved words that can not be used for naming a user-defined variable.

For example: class, int, for, etc.

3.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is the extension of java code files?

.txt

.java

.py

.html

4.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Media Image

What will be the output of the following Java code?

16

24

32

48

Answer explanation

Operator ++ acts like a "plus 1" (increment), so g becomes 4 and when multiplied by 8 gives 32.

5.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is the extension of compiled java classes?

.class

.java

.js

.code

6.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which exception is thrown when java is out of memory?

MemoryError

OutOfMemoryError

MemoryOutOfBoundsException

MemoryFullException

Answer explanation

The Xms flag has no default value, and Xmx typically has a default value of 256MB. A common use for these flags is when you encounter a java.lang.OutOfMemoryError.

7.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Media Image

What will be the output of the following Java code?

a

b

abc

c

Answer explanation

String(chars) is a constructor of class string, it initializes string s with the values stored in character array chars, therefore s contains “abc”.

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?