AP Computer Science Midterm Review

AP Computer Science Midterm Review

10th - 12th Grade

26 Qs

quiz-placeholder

Similar activities

Data Types- Python

Data Types- Python

7th - 11th Grade

25 Qs

HY Pre Test Part 1: Up to Control Statements.

HY Pre Test Part 1: Up to Control Statements.

11th Grade

28 Qs

Java Loops

Java Loops

10th - 12th Grade

24 Qs

Programming with Karel

Programming with Karel

7th - 12th Grade

25 Qs

APCSP 3a

APCSP 3a

12th Grade

24 Qs

Program Development - Python: Lists

Program Development - Python: Lists

8th - 10th Grade

22 Qs

Challenge Grade 4

Challenge Grade 4

4th Grade - University

23 Qs

APCSP BJC Unit 4

APCSP BJC Unit 4

9th - 12th Grade

28 Qs

AP Computer Science Midterm Review

AP Computer Science Midterm Review

Assessment

Quiz

Computers

10th - 12th Grade

Hard

Created by

Bill Butterfield

Used 57+ times

FREE Resource

26 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image
Which of the following pairs of declarations will cause an error message?
none
I only
II only
II and III only

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image
What will be produced by the following statement?
I
II
III
none of these

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image
The following code fragment outputs "13 / 5 = 2.0", however the programmer wanted it to output "13 / 5 = 2.6". Which of the following will NOT correct the error?
double answer = ( double ) 13 / 5;
double answer = 13 / ( double ) 5;
double answer = 13.0 / 5;
double answer = ( double ) ( 13 / 5 );

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image
Expressions follow order of operations rules. What value will result hold after this statement is executed?
-5
0
13
12

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image
Suppose that addition and subtraction had higher precedence than multiplication and division. What would the following expression evaluate as?
(hint: Use parentheses to elevate the rank of addition and subtraction operations)
7
8
0
1

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Assume aNum is a variable of type double that is positive. A program contains the boolean expression (Math.pow( aNum, 0.5 ) == Math.sqrt ( aNum )). Even though aNum1/2 is mathematically equivalent to √aNum the above expression returns the value false in a student's program. Which of the following is the most likely reason?
Math.pow returns an int, while Math.sqrt returns a double.
aNum was imprecisely calculated in a previous program statement.
The computer stores floating-point numbers with 32-bit words.
There is round-off error in calculating the pow and sqrt functions.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image
If a is of type int and has a value of 0 when the segment is executed, what will happen?
An ArithmeticException will be thrown.
statement2, but not statement1, will be executed.
statement1, but not statement2, will be executed.
A syntax error will occur.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?