Question: 1. Which of these classes is a utility class? A. Scanner B. Arrays C. Point D. BankAccount ==================================================== 2. What happens with the following code?
1. Which of these classes is a utility class?
A. Scanner
B. Arrays
C. Point
D. BankAccount
====================================================
2. What happens with the following code?
Question[] quiz = new Question[2];
quiz[0] = new ChoiceQuestion();
quiz[0].setText("What is the answer?");
quiz[0].addChoice("42", true);
quiz[0].addChoice("Something else", false);
quiz[0].display()
A. The code does not compile
B. The code compiles but does not display the choices when run
C. The code compiles and runs, but throws an exception when addChoice is called.
D. The program compiles and runs correctly.
=====================================================
3. What is displayed as the result of the following statements?
ChoiceQuestion cq = new ChoiceQuestion();
cq.setText("What is the answer?");
cq.addChoice("42", true);
Question q = cq;
q.display();
A. Nothing is displayed--there is a syntax error.
B. Nothing is displayed--the program crashes when executing one of these statements
C. Only the question text is displayed, not the choices.
D. The question text and choices are displayed.
(Seems these questions can't be answered here due to lack of information, however this is all the information that is given... Sorry)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
