Font size
Worksheets2-Term-MT-OOP
Total questions: 70
Worksheet time: 23mins
A Special Method
(a)
The programming approach whose core concept is to break down complex problems into smaller, manageable units.
(a)
The most restrictive access modifier in Java, which limits visibility only within the class where the member is declared.
(a)
The OOP principle that involves the grouping of data and the methods that operate on that data, while restricting direct access to some components.
(a)
The type of variables that an Interface in Java is explicitly prohibited from containing.
(a)
The default access level in Java (no keyword specified), which limits visibility to the class and the entire package.
(a)
The type of polymorphism that is resolved dynamically at runtime, typically associated with method overriding.
(a)
The access modifier that makes a class member visible to its own class, its package, and any subclass (even if the subclass is in a different package).
(a)
What the super keyword can be used to explicitly call when a subclass method has the exact same name and signature as an inherited superclass method.
(a)
What Java program structure element is a class that is defined entirely within the body of another class.
(a)
The keyword used when declaring a class to prevent any other class from inheriting it (subclassing).
(a)
The keyword used when declaring a method to prevent any subclass from altering its functionality (overriding).
(a)
The keyword that cannot be used in a constructor's declaration, along with static and abstract.
(a)
The type of data structure used to manage a collection of multiple objects of the same class.
(a)
The specific name for a type of polymorphism where multiple methods in the same class share the same name but have different parameter lists (signatures).
(a)
A construct used for grouping related classes and/or subpackages, which is analogous to a directory.
(a)
What class members are referred to as when they can be accessed directly using the class name, without first creating an instance of the class.
(a)
The keyword used in the class declaration syntax to establish an inheritance relationship with a parent class.
(a)
The programming concept that allows you to define a new complex data type (like a blueprint for objects).
(a)
The type of relationship in OOP (e.g., Aggregation and Composition) that signifies one object contains or references another object.
(a)
Given the class Lamp from the PPT snippet, which line correctly creates and initializes a new object named deskLamp?
new Lamp() = deskLamp
Imagine below is a complete java program
String s = "Java is a robust language. It is widely used for enterprise applications."; System.out.println(s.length());
The output is:
72
Imagine below is a complete java program
String s = "The quick brown fox. The fox is running fast.";
System.out.println(s.indexOf("fox"));
The output is:
20
Imagine below is a complete java program
String s = "This is line one. This is line two.";
System.out.println(s.contains("line one"));
The output is:
TRUE
Imagine below is a complete java program
String s = "Method testing is critical. Make sure your inputs are valid.";
System.out.println(s.toUpperCase());
The output is:
METHOD TESTING IS CRITICAL. MAKE SURE YOUR INPUT ARE VALID.
Imagine below is a complete Java program
String s = "Start here. End here.";
System.out.println(s.endsWith("here"));
The output is:
FALSE
Imagine below is a complete java program
String s = "This sentence has three words. This sentence has four words.";
String replaced = s.replace("words", "terms");
System.out.println(replaced.indexOf("words"));
The output is:
-1
Imagine below is a complete java program
String s = "\n\n Text with spaces. More spaces here. \n\n";
System.out.println(s.trim().length());
The output is:
42
Imagine below is a complete java program
String s = "Alpha Beta Gamma. Delta Epsilon.";
System.out.println(s.substring(11, 16));
The output is:
. Del
Imagine below is a complete java program
String s = "The index is 1. The index is 2.";
System.out.println(s.indexOf("index", 15));
The output is:
19
Imagine below is a complete java program
String s = "Check. What is the length?";
System.out.println(s.charAt(1));
The output is:
h
