0% found this document useful (0 votes)
737 views6 pages

Pre-Quiz Arrays and Strings - Attempt Review

Uploaded by

Kirti Saraf
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)
737 views6 pages

Pre-Quiz Arrays and Strings - Attempt Review

Uploaded by

Kirti Saraf
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/ 6

3/11/24, 12:19 AM Pre-Quiz Arrays and Strings: Attempt review


 Dashboard / My courses / Java / Arrays and Strings / Pre-Quiz Arrays and Strings

Quiz review
Started on Monday, 11 March 2024, 12:16 AM
State Finished
Completed on Monday, 11 March 2024, 12:19 AM
Time taken 3 mins 1 sec
Marks 5.00/8.00
Grade 62.50 out of 100.00
Feedback Oops!!! You have scored below 80%. So kindly make necessary preparation and reattempt.

Question 1
Incorrect

Mark 0.00 out of 1.00

47353

Identify which statement is true about construtors.

Select one:
a. Constructor of a class should not have a return type, which means the return type is void

b.
Constructor will be invoked explicitly like other methods

c. Constructor can be overloaded

d. 
Constructor should have same name as class name, but not case sensitive

47353
Your answer is incorrect.
The correct answer is:
Constructor can be overloaded

Question 2
Correct

Mark 1.00 out of 1.00

Predict the Output of following Java Program.


47353
class Test {
int x = 10;
public static void main(String[] args) {
System.out.println(x);
}
}

Select one:
a. 10

b. Compile Time Error 

c. Runtime Exception

d. 0

Your answer is correct.


The correct answer is: Compile Time Error

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1422218&cmid=5214 1/6
3/11/24, 12:19 AM Pre-Quiz Arrays and Strings: Attempt review

Question 3
Correct

Mark 1.00 out of 1.00

Which members of a class can be accessed by other classes is determined by the ________________

Select one:
a. class

b. variables

c. constructor

d. Access specifier 

Your answer is correct.


The correct answer is: Access specifier

47353

Question 4
Incorrect

Mark 0.00 out of 1.00

A JavaBeans component has the following field:


private boolean enabled;
Which two pairs of method declarations follow the JavaBeans standard for accessing this field? (Choose two.)

Select one or more:


a. public void setEnabled( boolean enabled )
47353
public boolean getEnabled()

b. public boolean setEnabled( boolean enabled ) 


public boolean getEnabled()

c. public void setEnabled( boolean enabled )


public boolean isEnabled()

d. public void setEnabled( boolean enabled )


public void isEnabled()

Your answer is incorrect.


When writing getters and setters, setters return type is void and getters return type is the corresponding data type. Naming convention is camelcase notation. For
47353start with get followed by field name. For boolean return type, it should start with 'is' or 'are' followed by
setters start with set followed by field name and for getters
field name.
The correct answers are: public void setEnabled( boolean enabled )
public boolean isEnabled(), public void setEnabled( boolean enabled )
public boolean getEnabled()

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1422218&cmid=5214 2/6
3/11/24, 12:19 AM Pre-Quiz Arrays and Strings: Attempt review

Question 5
Correct

Mark 1.00 out of 1.00

Identify the true statement(s).


Statement 1 : When no constructor is written in a class, the compiler creates a default constructor
Statement 2 : The default constructor will implicitly invoke the default / no-argument constructor of the super class
Statement 3 : If a class has a parametrized constructor alone, then the compiler will create the default constructor
Statement 4 : If a class has a parametrized constructor, it is mandatory to write a no-argument constructor

Select one:
a. 
1 and 2

b. 1, 2 and 3

c.
2 and 3
47353
d. 1, 2 and 4

Your answer is correct.


The correct answer is: 1 and 2

47353

47353

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1422218&cmid=5214 3/6
3/11/24, 12:19 AM Pre-Quiz Arrays and Strings: Attempt review

Question 6
Incorrect

Mark 0.00 out of 1.00

package edu.ABC.model;
public class Account {
public static final float INTERTEST_RATE = 7.5;
}

Identify the correct options from the classes provided below.

Select one or more:


a.
package edu.ABC.model;
public class Loan {
public double getInterest() {
return INTEREST_RATE;
47353
}
}

b. import static edu.ABC.model.Account ; 

public class Loan {


public double getInterest() {
return INTEREST_RATE;
}
}

c. 
import edu.ABC.model.Account ;
public class Loan {
public double getInterest() { 47353
return Account.INTEREST_RATE;
}
}

d.
import static edu.ABC.model.Account.*;
public class Loan {
public double getInterest() {
return INTEREST_RATE;
}
}

47353
Your answer is incorrect.
The correct answers are:
import static edu.ABC.model.Account.*;
public class Loan {
public double getInterest() {
return INTEREST_RATE;
}
}, import edu.ABC.model.Account ;
public class Loan {
public double getInterest() {
return Account.INTEREST_RATE;
}
}

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1422218&cmid=5214 4/6
3/11/24, 12:19 AM Pre-Quiz Arrays and Strings: Attempt review

Question 7
Correct

Mark 1.00 out of 1.00

Given:
public class ItemTest
{
private final int id;
public ItemTest(int id) {
this.id = id;
}
public void updateId(int newId) {
id = newId;
}
public static void main(String[] args) {
ItemTest fa = new ItemTest(42);
fa.updateId(69);
System.out.println(fa.id);
}
} 47353
What is the result?

Select one:
a. CompileTime Error 

b.
69

c.
Runtime Error

Your answer is correct.


The correct answer is: CompileTime Error 47353

Question 8
Correct

Mark 1.00 out of 1.00

What does this() mean in constructor chaining concept?

Select one:
a. Used for calling the parameterized constructor of the parent class.
47353

b. Used for calling the current object of the parent class.

c. 
Used for calling the no argument constructor of the same class.

d. Used for calling the current object of the same class.

Your answer is correct.


The correct answer is: Used for calling the no argument constructor of the same class.

◄ Post-Quiz - Classes and Objects, Packages

Jump to...

Arrays Intro Video ►

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1422218&cmid=5214 5/6
3/11/24, 12:19 AM Pre-Quiz Arrays and Strings: Attempt review

47353

47353

47353

https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1422218&cmid=5214 6/6

You might also like