0% found this document useful (0 votes)
2K views8 pages

Post-Quiz - Attempt Review

The summary provides the key details from the document: 1) The document is a review of a quiz that was taken on Java programming topics. 2) The quiz contained 8 questions and was completed in 8 minutes and 11 seconds. 3) The participant received a perfect score of 8 out of 8 and a grade of 100% on the quiz.

Uploaded by

19K41A0 450
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views8 pages

Post-Quiz - Attempt Review

The summary provides the key details from the document: 1) The document is a review of a quiz that was taken on Java programming topics. 2) The quiz contained 8 questions and was completed in 8 minutes and 11 seconds. 3) The participant received a perfect score of 8 out of 8 and a grade of 100% on the quiz.

Uploaded by

19K41A0 450
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

11/14/23, 3:58 PM 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

Mark 1.00 out of 1.00

Given:

public class Message {


String msg;
int noOfWords;

public Message() {
msg += " Thank you";
}
public Message(int noOfWords) {

this.noOfWords = noOfWords;
msg = "Welcome";

42763
Message();

}
public static void main(String args[]) {

Message m = new Message(5);

System.out.println(m.msg);
}

What will be the output ?

Select one:
a. Welcome Thank you 5 42763
b. An exception is thrown at runtime

c. Compilation fails

d. Welcome Thank you

e. Welcome

f. The code runs with no output

Your answer is correct.

The correct answer is: Compilation fails 42763

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

Mark 1.00 out of 1.00

Integer x1 = new Integer(120);

int x2 = 120;
System.out.println( x1 == x2 );

What will be the output of the above code fragment?

Select one:
a.
Runtime Exception

b. Compilation Error

c.
CastException

42763
d. true

e. false

Your answer is correct.

The correct answer is: true

Question 3
Correct

Mark 1.00 out of 1.00

42763
Which of the following is not a Java modifier?

Select one:
a.
public

b. 
virtual

c. private

d.

42763
protected

Your answer is correct.

The correct answer is: virtual

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

Mark 1.00 out of 1.00

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

Your answer is correct.


We call the access specifier default as “package level access” because, in a clss, members declared as default can be accessed only
within the package in which it is declared.

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

Mark 1.00 out of 1.00

Observe the code

public class Sample {


public static void main(String [] args) {

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++);

}
}

Given in command line - java Sample - What is the result?

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

e. An exception is thrown at runtime.

f.
display x = 7 main x = 7

Your answer is correct.

The correct answer is:


display x = 6 main x = 6

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

Mark 1.00 out of 1.00

What is the outcome of the code?

public class Item {


private String description;

public String getDescription() {


return description;
}
public void setDescription(String description) {

this.description = description;

42763
public static void modifyDesc(Item item,String desc) {

item=new Item();
item.setDescription(desc);

public static void main(String[] args) {


Item it=new Item();

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

Your answer is correct.

The correct answer is: Gobstopper


Fizzylifting

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

Mark 1.00 out of 1.00

Predict the output.

class X
{
void display(int a)

{
System.out.println("INT");
}

void display(double d)
{

42763
System.out.println("DOUBLE");

}
}

public class Sample


{

public static void main(String[] args)


{

new X().display(100);

42763
}
}

Select one:
a. INT

b. Ambiguity error

c. Compilation Fails

d. DOUBLE

Your answer is correct.

The correct answer is: INT


42763

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

Mark 1.00 out of 1.00

Given classes defined in two different files:

1. package p1;
2. public class Test {

3. public static void display(String [] a) { /* some code */ }


4. }

1. package p2;

2. public class TestMain {


3. public static void main(String[] args) {

42763
4. String [] names = new String[10];

5. // insert code here


6. }

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

Your answer is correct.

The correct answer is: p1.Test.display(names);

42763
◄ Incredible Toys

Jump to...

Additional Learning ►

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=685626&cmid=1245 8/8

You might also like