
Mastering Java Interfaces and Strings
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Dhanekula Csehod
Used 8+ times
FREE Resource
Enhance your content in a minute
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()
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Recursion Practice, Recursion Practice, Recursion Practice...
Quiz
•
10th Grade - University
20 questions
C - Structures
Quiz
•
University
20 questions
DreamWeaver CS6
Quiz
•
University
10 questions
Listen in Python
Quiz
•
University
10 questions
CP N5 Theory Test 1
Quiz
•
University
14 questions
Programación Orientada a Objetos: Conceptos básicos
Quiz
•
University
14 questions
LA7.C7: Turtle Graphics
Quiz
•
9th Grade - University
10 questions
ITESA Roadmap Event 12-09-24
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
