Introduction to object oriented programming

Introduction to object oriented programming

10th Grade

47 Qs

quiz-placeholder

Similar activities

PENILAIAN I / ANALISIS DATA

PENILAIAN I / ANALISIS DATA

9th - 12th Grade

50 Qs

Year 9 Mid-Term Assessment

Year 9 Mid-Term Assessment

10th Grade

45 Qs

Class 10 Arrays

Class 10 Arrays

10th Grade

50 Qs

Ulangkaji ASK Ting 2 Bab 3.1 Persekitaran Kod Arahan

Ulangkaji ASK Ting 2 Bab 3.1 Persekitaran Kod Arahan

1st - 12th Grade

52 Qs

ÔN TẬP PYTHON GKII - TIN HỌC 10

ÔN TẬP PYTHON GKII - TIN HỌC 10

10th Grade

42 Qs

Python Exam Practice

Python Exam Practice

9th - 12th Grade

43 Qs

Grade 10 Computer Quiz

Grade 10 Computer Quiz

10th Grade

43 Qs

Introduction to object oriented programming

Introduction to object oriented programming

Assessment

Quiz

Computers

10th Grade

Hard

Created by

scoremaster JAVA

FREE Resource

47 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which OOP principle means 'hiding internal details and showing only essential features'?

Encapsulation

Polymorphism

Inheritance

Abstraction

Answer explanation

The correct answer is 'Abstraction'. It refers to the OOP principle of hiding complex implementation details and exposing only the necessary features, allowing users to interact with objects without needing to understand their inner workings.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Java, which of the following is not a primitive data type?

byte

short

String

boolean

Answer explanation

In Java, primitive data types include byte, short, and boolean. However, String is not a primitive type; it is an object that represents a sequence of characters. Therefore, the correct answer is String.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method reads an entire line of text using Scanner?

next()

nextChar()

nextLine()

readLine()

Answer explanation

The correct method to read an entire line of text using Scanner is nextLine(). The next() method reads the next token, while nextChar() and readLine() are not valid methods in the Scanner class.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The expression 17/5 in Java evaluates to:

3.4

3

3.0

4

Answer explanation

In Java, when both operands are integers, integer division is performed. Thus, 17/5 evaluates to 3, discarding the decimal part. Therefore, the correct answer is 3.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement about the Math class is true?

You must create a Math object to use its methods

Most methods in Math are static

Math methods require java.util import

Math.round returns double only

Answer explanation

The correct statement is that most methods in the Math class are static, allowing them to be called without creating an instance of the class. The other options are incorrect regarding object creation, imports, and return types.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a switch statement, the 'default' case:

Must be the first case

Is optional

Must be last

Requires a break

Answer explanation

The 'default' case in a switch statement is optional, meaning it does not have to be included. It can appear anywhere, but it is not required to be the first or last case, nor does it necessarily require a break.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

System.out.print and System.out.println differ in that println:

Prints in bold

Flushes the buffer

Appends a newline

Prints to stderr

Answer explanation

System.out.println appends a newline after printing, while System.out.print does not. This means println moves the cursor to the next line, making it useful for formatting output.

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?