Docsity

java programming concepts mastery exam guide 2026 EDITION, Exams of Javascript programming

Toggle sidebar
bg1
COP 3330 Exam 2: Java Programming Concepts with Solutions, Exams of
Computer Science
What is NOT a reason to develop interfaces? - ANSWERThere is always a
single programmer who defines everything so they are in charge of the
interfaces as well
Interfaces can be instantiated. - ANSWERFalse
Interfaces can contain only: - ANSWERdefault methods
static methods
constants
nested types
method signatures
Interfaces can be implemented by other classes. - ANSWERTrue
Interfaces cannot be extended by other interfaces. - ANSWERFalse
When defining a method interface, it MUST be specified public, otherwise it
is only accessible where in a project? - ANSWERpackage
java programming concepts mastery exam guide 2026
2026 EDITION
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download java programming concepts mastery exam guide 2026 EDITION and more Exams Javascript programming in PDF only on Docsity!

COP 3330 Exam 2: Java Programming Concepts with Solutions, Exams of Computer Science What is NOT a reason to develop interfaces? - ANSWERThere is always a single programmer who defines everything so they are in charge of the interfaces as well Interfaces can be instantiated. - ANSWERFalse Interfaces can contain only: - ANSWERdefault methods static methods constants nested types method signatures Interfaces can be implemented by other classes. - ANSWERTrue Interfaces cannot be extended by other interfaces. - ANSWERFalse When defining a method interface, it MUST be specified public, otherwise it is only accessible where in a project? - ANSWERpackage

java programming concepts mastery exam guide 20

2026 EDITION

In a public interface body what are automatically considered public even if the programmer doesn't put the public access modifier on the associated method or member? - ANSWERstatic methods Constant declarations default methods abstract methods If an interface is declared public then a programmer can omit the public access modifier for all abstract, default, and static methods. - ANSWERTrue A programmer can define a reference variable with an interface as its data type if the constructor call to the left of the equals sign (=) is a class instance that implements that interface. - ANSWERTrue If a class implements an interface and extends a class, the resulting class can be an instance of:

  1. The interface
  2. The superclass
  3. The subclass - ANSWERTrue What is NOT a benefit of default methods in an interface? - ANSWERDefining what the method should do when implemented

When the error occurs within a method the method creates an object and hands it off to the runtime system, what is that object called? - ANSWERexception object What does an exception object contain? - ANSWERContains information about the error type Contains information about the error during the state of the program When a program enters an error state during runtime and creates an exception object, what is the term associated with the exception being made visible to the user or programmer? - ANSWERthrowing an exception When using an IDE or other compiler, if an exception occurs the programmer is provided with a listing of what methods were invoked when the exception happened. What is that listing called? - ANSWERcall stack There are many situations in programming when a programmer knows some logic may fail. As a result, they use a try/catch or try/catch/finally. This is known as what? - ANSWERException handling What is the purpose of the try block of code in a try/catch or try/catch/finally? - ANSWEREncloses the code that might throw an exception What is the purpose of the catch block of code in a try/catch or try/catch/finally? - ANSWERCode than is executed when the exception handler is invoked

What is the purpose of the finally block of code in a try/catch/finally? - ANSWERALWAYS executed when the try block exits unless the JVM exits, a thread is interrupted or killed Collections are used to store, retrieve, manipulate, and communicate aggregate data. Which of the following would NOT be an appropriate application of a collection? a mail folder a poker hand a single user account a telephone directory - ANSWERa single user account A collections framework is a unified architecture for representing and manipulating collections. Which of the following in NOT contained in a collections framework? Algorithms Abstract classes Interfaces Implementations - ANSWERAbstract classes What are the benefits of the Collections framework? - ANSWERReduces programming effort Reduces effort to learn and to use new APIs

SortedSet - ANSWERA set that maintains its elements in ascending order SortedMap - ANSWERUsed for naturally ordered collections of key/value pairs, such as dictionaries and telephone directories What are basic operations contained within the Collections framework? - ANSWERboolean contains(Object element) boolean remove(Object element) int size() What is a bulk operation regarding Collections? - ANSWERBulk operations perform an operation on an entire Collection There are three ways to traverse collections. Which of the following is not one of them? aggregate operations using a switch statement the for-each construct using Iterators - ANSWERusing a switch statement

Generics enable types are similar to __________. - ANSWERformal parameters used in method declarations Regarding a generic class, in the type parameter section, what is used to delimit the class name? - ANSWERclass name { /* ... */ } E - ANSWERElement K - ANSWERKey N - ANSWERNumber T - ANSWERType V - ANSWERValue An invocation of a generic type is generally known as a parameterized type. What does this mean regarding memory allocation? - ANSWERno object has been created yet When creating an instance of a generic class you still need to use the keyword new. - ANSWERTrue The following source code is valid for instantiating an instance of class Box using the explicit class Integer as the data type.

FINER

SEVERE - ANSWERON

OFF - ANSWERIs a special level that can be used to turn off logging SEVERE - ANSWERIs a message level indicating a serious failure WARNING - ANSWERIs a message level indicating a potential problem INFO - ANSWERIs a message level for informational messages CONFIG - ANSWERIs a message level for static configuration messages Polymorphism refers to a principle in biology in which an organism or species can have many different forms or stages - ANSWERTrue What is polymorphism in object-oriented programming? - ANSWERWhen a class implements one or more interfaces and may also extend a superclass Multiple inheritance of state in polymorphism refers to what situation in object oriented programming? - ANSWERThe ability to inherit fields from multiple classes Multiple inheritance of implementation in polymorphism refers to what situation in object oriented programming? - ANSWERThe ability to inherit method definitions from multiple classes

Multiple inheritance of type in polymorphism refers to what situation in object oriented programming? - ANSWERA class can implement more than one interface AND An object can have multiple types When polymorphism is applied to OOP it means that - ANSWERSubclasses can share some of the same behavior of the parent class but also can define their own unique behaviors Polymorphism in the Java programming language allows for extending multiple superclasses. - ANSWERFalse Classes that cannot have objects created from them are called - ANSWERabstract classes Abstract classes are used only as superclasses in inheritance hierarchies and are referred to as - ANSWERabstract superclasses What is a subclass of an abstract superclass called that declares the missing pieces of the abstract class and can be instantiated? - ANSWERconcrete class Abstract classes can be instantiated. - ANSWERFalse Why do developers create abstract classes? - ANSWERTo provide an appropriate superclass from which other classes can inherit To share a common design

methods that can access and modify the state of the object to which they belong Want to declare non-static or non-final fields Expect that classes that extend the abstract class have many common methods or fields, or require access modifiers other than public (such as protected and private) Want to share code among several closely related classes When deciding between an abstract class and an interface, which of the following would apply to selecting an interface? Expect that classes that extend the abstract class have many common methods or fields, or require access modifiers other than public (such as protected and private) This enables you to define methods that can access and modify the state of the object to which they belong Want to take advantage of multiple inheritance of type Want to share code among several closely related classes Want to declare non-static or non-final fields.

Expect that unrelated classes would implement the interface Want to specify the behavior of a particular data type, but not concerned about who implements its behavior - ANSWERWant to take advantage of multiple inheritance of type Expect that unrelated classes would implement the interface Want to specify the behavior of a particular data type, but not concerned about who implements its behavior Classes can be declared as final - ANSWERTrue Using the final keyword in a method declaration to indicate that the method cannot be overridden by subclasses - ANSWERTrue A class that is declared final can be subclassed - ANSWERFalse