Unit 3 quiz 1 ap Computer Science

AP Computer Science Unit Quiz and Unit Test on Methods. Topics include method structure and using methods.

Q1 - What are if statements used for in programs?

Ans - Controlling the sequence of execution

Q2 - What correction should be made so the code functions as intended?

Ans - Curly braces '{}' should be added to enclose the second and third lines

Q3 - What is output

Ans - The answer is: ab

Q4 - What is output to the screen by the following code?

Ans - 2

Q5 - Which of the following is a legal variable name in Java?

Ans - other_var

Q6 - Which of the following code segments will print "large enough" when the square of the number var is larger than 25?

Ans - if (Math.pow(var, 2) > 25)

{

System.out.println("large enough");

}

Q7 - Which of the following will have the exact same result?

Ans - II and III only

Q8 - Of the following code blocks, which one correctly executes exactly two commands when the condition is true?

Ans - III only

Q9 - What is wrong with the following code?

Ans - The equals sign, =, should be replaced with a double equals, ==.

Q10 - What is output by the following code segment?

Ans - four

2/3/2021Unit 3, Quiz 1: AP Computer Science PrinciplesUnit 3, Quiz 1DueNov 24, 2020 at 8pmPoints4Questions4Availableafter Nov 24, 2020 at 10amTime LimitNoneAttempt HistoryAttemptTimeScoreLATESTAttempt 19 minutes4 out of 4Correct answers are hidden.Score for this quiz:4out of 4Submitted Nov 24, 2020 at 11:43amThis attempt took 9 minutes.1 / 1 ptsQuestion 1There is a base 6 number system that uses symbols instead of numerals torepresent different values. Below is the symbol that represents eachnumeral.= 0= 1= 2= 3= 4= 5Which of the following numbers written using this base 6 number system isequivalent to the base 10 number 147?None of the options listed