Professional Documents
Culture Documents
Post-Quiz - Attempt Review
Post-Quiz - Attempt Review
Dashboard / App Dev / Stage - 1 / Java Programming / Classes and Objects, Packages
Quiz review
Started on Sunday, 12 November 2023, 6:55 PM
State Finished
Completed on Sunday, 12 November 2023, 7:03 PM
Time taken 8 mins 11 secs
Marks 8.00/8.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
42763
42763
42763
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 1/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 1
Correct
Given:
public Message() {
msg += " Thank you";
}
public Message(int noOfWords) {
this.noOfWords = noOfWords;
msg = "Welcome";
42763
Message();
}
public static void main(String args[]) {
System.out.println(m.msg);
}
Select one:
a. Welcome Thank you 5 42763
b. An exception is thrown at runtime
c. Compilation fails
e. Welcome
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 2/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 2
Correct
int x2 = 120;
System.out.println( x1 == x2 );
Select one:
a.
Runtime Exception
b. Compilation Error
c.
CastException
42763
d. true
e. false
Question 3
Correct
42763
Which of the following is not a Java modifier?
Select one:
a.
public
b.
virtual
c. private
d.
42763
protected
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 3/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 4
Correct
The methods of a class with the ____________ access specifier cannot be accessed in its subclass class of different package.
Select one:
a. default
b. protected
c. public
42763
The correct answer is: default
42763
42763
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 4/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 5
Correct
int x = 6;
Sample p = new Sample();
p.display(x);
System.out.print(" main x = " + x);
}
void display(int x) {
42763
System.out.print(" display x = " + x++);
}
}
Select one:
a.
display x = 7 main x = 6
b.
display x = 6 main x = 7
42763
c.
Compilation fails.
d.
display x = 6 main x = 6
f.
display x = 7 main x = 7
42763
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 5/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 6
Correct
this.description = description;
42763
public static void modifyDesc(Item item,String desc) {
item=new Item();
item.setDescription(desc);
it.setDescription("Gobstopper");
Item it2=new Item();
it2.setDescription("Fizzylifting");
42763
it.modifyDesc(it,"Scrumdiddlyumptious");
System.out.println(it.getDescription());
System.out.println(it2.getDescription());
}
}
Select one:
a. Gobstopper
Scrumdiddlyumptious
b. Scrumdiddlyumptious
Fizzylifting
c. Compilation fails
42763
d. Gobstopper
Fizzylifting
e. Scrumdiddlyumptious
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 6/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 7
Correct
class X
{
void display(int a)
{
System.out.println("INT");
}
void display(double d)
{
42763
System.out.println("DOUBLE");
}
}
new X().display(100);
42763
}
}
Select one:
a. INT
b. Ambiguity error
c. Compilation Fails
d. DOUBLE
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 7/8
11/14/23, 3:58 PM Post-Quiz: Attempt review
Question 8
Correct
1. package p1;
2. public class Test {
1. package p2;
42763
4. String [] names = new String[10];
7. }
Identify the statement to be written in line 5 in class TestMain to call the display method of class Test.
Select one:
a.
display(names);
b.
c.
p1.Test.display(names);
42763
import p1.Test.*; display(names);
d. p1.display(names);
e.
TestMain cannot use methods in p1
42763
◄ Incredible Toys
Jump to...
Additional Learning ►
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 8/8