Dashboard Java Inheritance, Polymorphism, Abstract Class, Interface Pre-Quiz
Dashboard Java Inheritance, Polymorphism, Abstract Class, Interface Pre-Quiz
Dashboard Java Inheritance, Polymorphism, Abstract Class, Interface Pre-Quiz
Adeeb Khan .
Question
Given:
1 21. public String makingStrings() {
Correct
22. String str = "Welcome";
Mark 1.00 out
23. str = str.substring(1, 5);
of 1.00
24. str = str.toUpperCase();
How many String objects will be created when this method is invoked?
Select one:
a. 4
b. 3
c. 2
d. 1
Question To copy elements from one array to another array, Java provides efficient built-in methods in ________ class.
2
Correct
b.
Array
c.
Arrays
d. Collection
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1036832&cmid=1020#q4 1/6
31/03/2020 Pre-Quiz: Attempt review
else {
}
test(null);
}
Select one:
a. An exception is thrown at runtime.
b.
"String is empty" is printed to output.
c.
Compilation fails
d.
"String is not empty" is printed to output.
}
Select one:
a. 11 12 13 14 15
b. 0 0 0 0 0
c. 0 0 0
d. 11 12 13
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1036832&cmid=1020#q4 2/6
31/03/2020 Pre-Quiz: Attempt review
cities.equals(capitals) : true
Question In Java, what happens if you try to compile the below code :
6 class MyStringDemo extends String {
Incorrect
}
Mark 0.00 out
of 1.00
Select one:
a. The code does not compile because the String class is final.
c. The code does not compile because the String class is abstract.
d. The code does not compile because you have not defined a main() method.
The correct answer is: The code does not compile because the String class is final.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1036832&cmid=1020#q4 3/6
31/03/2020 Pre-Quiz: Attempt review
System.out.println(s2.compareTo(s1));
}
Select one:
a. 1
b. 0
c. false
d. true
Question
What will be the output of the program?
8 public class Test {
Correct
public static void main (String args[]) {
Mark 1.00 out
of 1.00
String str = NULL;
System.out.println(str);
}
Select one:
a. Compile time error
b. Runtime Exception
c. NULL
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1036832&cmid=1020#q4 4/6
31/03/2020 Pre-Quiz: Attempt review
s1 = s1 + " to Java";
System.out.println(s1);
Select one:
a. WELcOME to Java
b. welcome to Java
c. WELCOME TO JAVA
d. WELCOME to Java
}
}
Select one:
a. Compile time error
b. Runtime error
c. ArrayIndexOutOfBoundsException
d. 0
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1036832&cmid=1020#q4 5/6
31/03/2020 Pre-Quiz: Attempt review
Adeeb Khan .
Select one:
a.
Unpredictable
b. Compilation error
c.
3
d.
2
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1036832&cmid=1020#q4 6/6