Search Header Logo

GEMS Quiz

Authored by Suyog M

Education

University

Used 1+ times

GEMS Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

39 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the difference between String and StringBuilder in Java?

a) String is mutable, and StringBuilder is immutable
b) String is thread-safe, and StringBuilder is not
c) String is faster than StringBuilder
d) String has more methods than StringBuilder

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

How do you handle exceptions in Java?

a) Using throws keyword
b) Using try-catch blocks
c) Ignoring exceptions
d) Using finally block

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of JUnit's @Test annotation?

a) It specifies the order of execution
b) It marks a method as a test case
c) It defines a timeout for the test
d) It skips the test case

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

How can you create a custom exception in Java?

a) By extending RuntimeException
b) By implementing the Exception interface
c) By using the throw keyword
d) By calling System.exit()

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the use of static keyword in Java?

a) To define a variable with constant value
b) To create objects of a class
c) To access class members without creating an instance
d) To implement singleton pattern

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you write a for loop in Java?

a) for (int i = 0; i < n; i++)
b) for (int i = n; i >= 0; i--)
c) for (int i = 1; i <= n; i++)
d) for (int i = n; i > 0; i--)

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the equals() method in Java?

a) To compare two objects for identity
b) To compare two objects for equality
c) To check if an object is null
d) To clone an object

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?