COP3330 Exam Questions with
Correct Answers 100% PASS
Which of the following statement is false? - CORRECT ANSWER-When you
enhance an existing interface with default methods-any class that implemented the
original interface will break.
Which of the following statements is false? - CORRECT ANSWER-An interface's
private static methods can be called by a default method in the interface
Which of the following statements is false? - CORRECT ANSWER-You cannot
prevent client code from creating objects of a class.
Polymorphism allows for specifics to be dealt with during - CORRECT
ANSWER-execution
Consider the following piece of code and choose the output: - CORRECT
ANSWER-Derived fun() called
Which of the following could be used to declare abstract method method1 in
abstract class Class1 (method1 returns an int and takes no arguments)? -
CORRECT ANSWER-public abstract int method1()
,Consider the abstract superclass below: - CORRECT ANSWER-Both A and B.
Consider classes A, B, and C, where A is an abstract superclass, B is a concrete
class that inherits from A and C is a concrete class that inherits from B. Class A
declares abstract method originalMethod, implemented in class B. Which of the
following statements is true of class C? - CORRECT ANSWER-None of them.
Which of the following represents the output of the following code segments? -
CORRECT ANSWER-Print "Base Constructor Called" then print "Derived
Constructor Called"
Every object in Java knows its own class and can access this information through
method: - CORRECT ANSWER-getClass
Which of the following represents the output of the following code segment? -
CORRECT ANSWER-it will show an error for line "Derived d = new Base()".
Which of the following lines is false about final Classes and final methods: -
CORRECT ANSWER-final methods are static
Which keyword is used to specify that a class will define the methods of an
interface? - CORRECT ANSWER-implements
Which of the following is not possible? - CORRECT ANSWER-A class that
inherits from two classes.
COPYRIGHT ©️ 2025 ALL RIGHTS RESERVED
, A class that implements an interface but does not declare all of the interface's
methods must be declared - CORRECT ANSWER-abstract
Consider the statements below: - CORRECT ANSWER-String r1 =
a.concat(b.concat(c));
String objects are immutable. This means they - CORRECT ANSWER-cannot be
changed
The length of a string can be determined by - CORRECT ANSWER-the String
method length()
What will be the output of the following code segment? - CORRECT ANSWER-
hello
The statement
s1.equalsIgnoreCase(s4)
is equivalent to which of the following? - CORRECT ANSWER-
s1.regionMatches(true, s4, 0, s4.length());
For
String c = "Hello. She sells sea shells";
Correct Answers 100% PASS
Which of the following statement is false? - CORRECT ANSWER-When you
enhance an existing interface with default methods-any class that implemented the
original interface will break.
Which of the following statements is false? - CORRECT ANSWER-An interface's
private static methods can be called by a default method in the interface
Which of the following statements is false? - CORRECT ANSWER-You cannot
prevent client code from creating objects of a class.
Polymorphism allows for specifics to be dealt with during - CORRECT
ANSWER-execution
Consider the following piece of code and choose the output: - CORRECT
ANSWER-Derived fun() called
Which of the following could be used to declare abstract method method1 in
abstract class Class1 (method1 returns an int and takes no arguments)? -
CORRECT ANSWER-public abstract int method1()
,Consider the abstract superclass below: - CORRECT ANSWER-Both A and B.
Consider classes A, B, and C, where A is an abstract superclass, B is a concrete
class that inherits from A and C is a concrete class that inherits from B. Class A
declares abstract method originalMethod, implemented in class B. Which of the
following statements is true of class C? - CORRECT ANSWER-None of them.
Which of the following represents the output of the following code segments? -
CORRECT ANSWER-Print "Base Constructor Called" then print "Derived
Constructor Called"
Every object in Java knows its own class and can access this information through
method: - CORRECT ANSWER-getClass
Which of the following represents the output of the following code segment? -
CORRECT ANSWER-it will show an error for line "Derived d = new Base()".
Which of the following lines is false about final Classes and final methods: -
CORRECT ANSWER-final methods are static
Which keyword is used to specify that a class will define the methods of an
interface? - CORRECT ANSWER-implements
Which of the following is not possible? - CORRECT ANSWER-A class that
inherits from two classes.
COPYRIGHT ©️ 2025 ALL RIGHTS RESERVED
, A class that implements an interface but does not declare all of the interface's
methods must be declared - CORRECT ANSWER-abstract
Consider the statements below: - CORRECT ANSWER-String r1 =
a.concat(b.concat(c));
String objects are immutable. This means they - CORRECT ANSWER-cannot be
changed
The length of a string can be determined by - CORRECT ANSWER-the String
method length()
What will be the output of the following code segment? - CORRECT ANSWER-
hello
The statement
s1.equalsIgnoreCase(s4)
is equivalent to which of the following? - CORRECT ANSWER-
s1.regionMatches(true, s4, 0, s4.length());
For
String c = "Hello. She sells sea shells";