0% found this document useful (0 votes)
2 views1 page

Introduction To Java - Quiz 01

The document is a quiz on Java programming concepts, covering topics such as method access modifiers, operators, data types, and class inheritance. It includes multiple-choice questions that test knowledge on Java syntax and functionality. The quiz serves as an introductory assessment for developers learning Java.

Uploaded by

waynemoore55
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Introduction To Java - Quiz 01

The document is a quiz on Java programming concepts, covering topics such as method access modifiers, operators, data types, and class inheritance. It includes multiple-choice questions that test knowledge on Java syntax and functionality. The quiz serves as an introductory assessment for developers learning Java.

Uploaded by

waynemoore55
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to Java -

Quiz 01

A developer wants to ensure that


subclasses cannot modify a method’s
implementation. Which keyword should be
used?

static

private

final

public

What does JVM stand for?

Java Variable Machine

Java Virtual Machine

Java Verified Machine

Java Visual Machine

Consider the expression 100D / 8Since


both operands are doubles, what result is
produced?

12

12.5

13

12.0

A class contains two methods named


calculateArea(), but each takes a different
number or type of parameters. What Java
feature is being used?

Same method name, different


parameters

Same method name, same parameters

Methods defined in different classes

Overriding superclass methods

Which operator is used for logical AND?

&

&&

AND

&&&

In Java, what does the ++ operator do


when applied to a variable?

Adds 2

Adds 1

Multiplies by 2

Divides by 2

What will 5 + 2 * 3 evaluate to?

21

11

16

13

Which keyword prevents inheritance?

static

private

final

protected

Which operator is used for comparison?

==

:=

equals

Every class in Java automatically inherits


methods such as toString() and equals().
From which class are these methods
inherited?

Class

Main

Object

System

A method should be accessible to


subclasses even if they are in different
packages, but not to unrelated classes.
Which modifier is appropriate?

default

private

protected

final

Which loop is best when number of


iterations is known?

while

do-while

for

switch

The JDK contains:

Only JVM

Only compiler

Only libraries

JRE + development tools

Which part of Java handles memory


management automatically?

Compiler

JVM

Garbage Collector

Scanner

Which component of the Java platform


executes Java bytecode by translating it
into machine instructions for the host
system?

Compiler

Interpreter

JVM

IDE

Which method prints output?

[Link]()

[Link]()

print()

display()

Suppose class B extends class If another


class C also wants to reuse the
functionality of A, what restriction does
Java impose?

C may extend both A and B

C may extend only one superclass

C must extend exactly two


superclasses

C may extend unlimited classes

Which keyword creates an object?

create

object

new

make

Which of the following will you consider a


valid Java variable name?

2number

number-1

_total

class

Java is case sensitive. This means:

JAVA and java are same

Variable names ignore case

Case applies only to classes

Identifiers with different cases are


different

What is inheritance?

A class acquiring properties of another


class

Creating objects

Writing loops

Overloading methods

Which keyword is used to inherit a class?

inherits

extends

implements

super

What is encapsulation?

Hiding data using private variables

Writing loops

Running JVM

Printing output

Which operator adds a value to a variable


and assigns the result back to the same
variable?

=+

+=

++=

add=

What is the default value of a boolean


variable?

true

false

null

Which keyword is used to define a class?

define

class

Class

new

Java source code is compiled into:

Bytecode

Machine code

Executable file

Script

Which data type stores true or false?

int

char

float

boolean

In Java, the expression 100 / 8 is


evaluated using integer arithmetic What
result is produced?

12

12.5

13

12.0

What is the return value of [Link](9)?

Option 1

A variable should be accessible only


within the class in which it is declared,
even to subclasses. Which modifier
enforces this?

public

protected

private

default

Which method is the entry point of a Java


program?

start()

run()

main()

init()

A Java class must implement two


unrelated interfaces such as Serializable
and Runnable. What does Java allow?

A class may implement only one


interface

A class may implement two interfaces


only

A class may implement any number of


interfaces

A class cannot implement interfaces


directly

Which primitive type stores a single


character?

String

char

Character

text

A subclass defines a method with the


same name and parameter list as a
method already defined in its superclass
to change its behavior. What concept
does this illustrate?

Same method name, same parameters


in subclass

Same method name, different


parameters

Method duplication

Method renaming

A method declared without any access


modifier should only be accessible to
classes within the same package. What
access level is this?

private

default

protected

public

A programmer needs the absolute (non-


negative) value of a number. Which
method from the Math class should be
used?

[Link]()

Math.floor()

[Link]()

[Link]()

How many times will this loop run?


for(int i=0; i<3; i++)

Infinite

Which data type is used to store decimal


numbers?

int

double

char

boolean

What is the return value of [Link](9)?

3.0

81

Which is a primitive data type?

String

Integer

int

Scanner

Which symbol is used for single-line


comments?

/* */

//

--

The JRE contains:

Compiler only

JVM and libraries

Source code

IDE

Which description correctly defines


method overloading?

Same method name, different


parameter lists

Same method name, same parameters

Different name, same parameters

Methods defined in multiple classes

Which operator returns the remainder


when one integer is divided by another?

You might also like