Mastering Java Interfaces and Strings

Mastering Java Interfaces and Strings

University

15 Qs

quiz-placeholder

Similar activities

Java - Nivelamento

Java - Nivelamento

University

15 Qs

JAVA I/O

JAVA I/O

University

10 Qs

Interactivity with JavaScript

Interactivity with JavaScript

University

15 Qs

Java Quiz

Java Quiz

University

10 Qs

JavaScript Variables, Data Types, and Operators Quiz

JavaScript Variables, Data Types, and Operators Quiz

University

18 Qs

JAVA Basics Quiz

JAVA Basics Quiz

University

20 Qs

Quiz 2 PBO

Quiz 2 PBO

University

20 Qs

Java

Java

University

11 Qs

Mastering Java Interfaces and Strings

Mastering Java Interfaces and Strings

Assessment

Quiz

Computers

University

Hard

Created by

Dhanekula Csehod

Used 8+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is an interface in Java?

An interface can contain implementation of methods.

An interface is a way to create objects in Java.

An interface in Java is a contract that classes can implement, defining methods that must be created in the implementing class.

An interface is a type of class in Java.

2.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

How do you declare an interface in Java?

interface MyInterface { void myMethod(); }

public class MyInterface { void myMethod(); }

MyInterface interface { void myMethod(); }

public interface MyInterface { void myMethod(); }

3.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is the purpose of the 'implements' keyword?

To define a new class

To create a variable

To indicate that a class implements an interface.

To inherit properties from another class

4.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Explain the difference between an abstract class and an interface.

An abstract class can have implemented methods and state, while an interface only defines method signatures and cannot hold state.

An abstract class can only be instantiated, while an interface cannot be instantiated at all.

An abstract class can have multiple inheritance, while an interface cannot have any inheritance.

An abstract class cannot have any methods, while an interface can have implemented methods.

5.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

Which method is used to compare two strings for equality in Java?

compareTo()

stringCompare()

isEqual()

equals()

6.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is the output of '"Hello".length()' in Java?

5

Hello World

4

6

7.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

How do you convert a string to lowercase in Java?

myString.convertToLower()

myString.toLower()

myString.lowercase()

myString.toLowerCase()

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?