Quiz 10 – Part A

advertisement
Exposure Java 2015 for Teaching
AP® Computer Science
DYRT Quiz 04.01-04
Take out a piece of paper and PEN.
The quiz starts TWO minutes after
the tardy bell rings.
You will have 30 seconds per question.
Title the quiz as shown below
The quiz starts in ONE minute.
Name
Period
Date
Quiz 04.01-04
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
EC.
Question 01
OOP is an acronym for
(a) Object Organized Protocol.
(b) Organized Oriented Protocol.
(c) Object Oriented Programming.
(d) Oriental Object Programming.
Question 02
The most important goal of program development
in the past and today is
(a) speed.
(b) user-friendliness.
(c) reliability.
(d) low production cost.
Question 03
Object Oriented Programming (OOP) is a style of
programming that uses
(a) encapsulation.
(b) class interaction.
(c) polymorphism.
(d) all of the above.
Question 04
Which of these programming stages had a major
problem caused by the GOTO statement?
(a) Cryptic Programming Stage
(b) Unstructured, Spaghetti-Programming Stage
(c) Structured Programming Stage
(d) Object Oriented Programming Stage
Question 05
In the statement: double x = Math.floor(3.976);
Math is the
(a)
(b)
(c)
(d)
parameter.
method identifier.
class identifier.
separator between the class identifier and the
method identifier.
Question 06
In the statement: double x = Math.floor(3.976);
floor is the
(a)
(b)
(c)
(d)
parameter.
method identifier.
class identifier.
separator between the class identifier and the
method identifier.
Question 07
In the statement: double x = Math.floor(3.976);
3.976 is the
(a)
(b)
(c)
(d)
parameter.
method identifier.
class identifier.
separator between the class identifier and the
method identifier.
Question 08
What is the value of result after the following
statement?
double result = Math.floor(5.789);
(a)
(b)
(c)
(d)
(e)
6
5.8
5.5
5.1
5
Question 09
What is the value of result after the following
statement?
double result = Math.ceil(5.123);
(a)
(b)
(c)
(d)
(e)
6
5.8
5.5
5.1
5
Question 10
What is the value of result after the following
statement?
double result = Math.round(5.499);
(a)
(b)
(c)
(d)
(e)
6
5.8
5.5
5.1
5
Question 11
What is the value of result after the following
statement?
double result = Math.round(5.5);
(a)
(b)
(c)
(d)
(e)
6
5.8
5.5
5.1
5
Question 12
What is the value of result after the following
statement?
double result = Math.pow(3,2);
(a)
(b)
(c)
(d)
5
6
8
9
Question 13
What is the value of result after the following
statement?
double result = Math.pow(2,3);
(a)
(b)
(c)
(d)
5
6
8
9
Question 14
What is the value of result in the following
statement?
double result = Math.sqrt(64);
(a) 64
(d) 1
(b) 8
(e) 0
(c) -8
(f) NaN
Question 15
What is the value of result in the following
statement?
double result = Math.sqrt(-64);
(a) 64
(d) 1
(b) 8
(e) 0
(c) -8
(f) NaN
Question 16
What is the value of result in the following
statement?
double result = Math.sqrt(1);
(a) 64
(d) 1
(b) 8
(e) 0
(c) -8
(f) NaN
Question 17
What is the output of the following statement?
System.out.println(Math.abs(-1));
(a) -1
(c) 1
(b) 0
(d) 2
Question 18
What is the output of the following statement?
System.out.println(Math.abs(1));
(a) -1
(c) 1
(b) 0
(d) 2
Question 19
What is the output of the following statement?
System.out.println(Math.min(20,30));
(a) -30
(c) 20
(b) -20
(d) 30
Question 20
What is the output of the following statement?
System.out.println(Math.max(20,30));
(a) -30
(c) 20
(b) -20
(d) 30
Question 21
What is the output of the following statement?
System.out.println(Math.min(-20,-30));
(a) -30
(c) 20
(b) -20
(d) 30
Question 22
What is the output of the following statement?
System.out.println(Math.max(-20,-30));
(a) -30
(c) 20
(b) -20
(d) 30
Question 23
The information passed to a method is called
(a) a parameter.
(b) an argument.
(c) both a and b.
(d) none of the above.
Question 24
What is the value of result at the conclusion of this
program segment?
double n1 = 9;
double n2 = 16;
double result = Math.sqrt(n1 + n2);
(a) 5
(c) 25
(b) 7
(d) 625
Question 25
What is the value of result at the conclusion of this
program segment?
double n1 = 9;
double n2 = 16;
double result = Math.sqrt(n1) + Math.sqrt(n2);
(a) 5
(c) 25
(b) 7
(d) 337
Extra Credit
What is the output of the following statement?
double x = (Math.max(Math.pow(2,3),Math.pow(3,2)));
System.out.println(x);
(a) 5
(b) 6
(c) 8
(d) 9
(e) 72
Download