OODJ - Test 1 - QP
OODJ - Test 1 - QP
a) Association
b) Aggregation
c) Composition
d) Inheritance
e) None of the mentioned.
2. Identify the appropriate type of relationship among the use cases shown in below figure:
a) extends
b) generalization
c) includes
d) inheritance
e) polymorphism
4. What will be the output of the following code if 6,9,12,9,15 are the inputs?
a) 12 6 2 4 8 10 14 16 18 20
b) 12 2 4 8 10 14 16 18 20 6
c) 12 6 2 8 10 14 16 18 4 20
d) 12 10 14 16 18 20 6 2 20
e) 12 6 2 4 8 10 14 16 14 20
5. What will be the output of the following code, if the input is 9001?
import java.util.*;
public class NewClass {
a)
Method APU: 10
Method APIIT: 1009
Method APIS: 1
b)
Method APU: 1
Method APIIT: 10
Method APIS: 1009
c)
Method APU: 10
Method APIIT: 1
Method APIS: 1009
d)
Method APU: 1009
Method APIIT: 1
Method APIS: 10
e)
None
a) Throw
b) Run
c) Exit
d) Catch
e) Error.
7. Given the list of outputs, select the correct output produced by the following code:
}
}
a) Hi Hi Hi Hi Hi
b) Hello Hello Hello
Bye Bye Bye
c) Bye Bye Bye
d) Hi Hi Hi Hi Hi
Hello Hello Hello
Bye Bye Bye
e) Hello Hello Hello
9. A Constructor is explained as
a) method that must have the same name as the class it is declared within.
b) used to create objects.
c) method that can be declared private
d) both a) and b) above
e) a), b) and c) above.
10. Superclass methods with this level of access cannot be called from subclasses.
a) private.
b) public.
c) protected.
d) package.
e) Abstract
SECTION B
DESCRIPTIVE QUESTIONS (15 MARKS)
ANSWER ALL QUESTION
B1. Write the Java code for applying the following requirement:
(Total: 10 marks)
B2. Given the following snippet of Java code, Find the Five mistakes and correct them.
int inputValue;
inputValue = intInput.nextInteger();
System.out.println("The Value " & inputValue & " is Greater than 10.");
(Total: 5 marks)