Search Header Logo

Java Concepts Quiz

Authored by Crackify Crackify

Other

University

Used 1+ times

Java Concepts Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Where is a local variable stored in Java?

Stack

Heap

PermGen

Code Segment

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which memory area stores objects in Java?

Stack

Heap

Method Area

Registers

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method returns the hash code of an object?

hashValue()

hash()

hashCode()

getHash()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the contract between equals() and hashCode()?

If two objects are equal, they must have the same hash code

If hash codes are same, objects are always equal

They are unrelated

Only equals() matters in Collections

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you override equals() but not hashCode()?

Compilation error

Runtime error

May break hash-based collections

Nothing happens

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What data structure does HashMap use internally?

Array

LinkedList

Array + LinkedList/Tree

TreeMap

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to compare contents of two strings?

==

equals()

compare()

hashCode()

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?