preap computer science quiz 10.01- 08 take out a piece of paper and pen. the quiz starts one minute...

28
PreAP Computer Science Quiz 10.01- 08 Take out a piece of paper and PEN . The quiz starts ONE minute after the tardy bell rings. You will have between 20 and 45 seconds per question.

Upload: primrose-atkinson

Post on 28-Dec-2015

227 views

Category:

Documents


1 download

TRANSCRIPT

PreAP Computer ScienceQuiz 10.01- 08

Take out a piece of paper and PEN.

The quiz starts ONE minute after the tardy bell rings.

You will have between 20 and 45 seconds per question.

Title the quiz as shown belowThe quiz starts in ONE minute.

Name Period Date

Quiz 10.01-081. 14.2. 15.3. 16.4. 17.5. 18.6. 19.7. 20.8. 21.9. 22.10. 23.11. 24.12. 25.13. EC.

Question 1

Which of the following is NOT a Boolean statement?

(A) 2 + 2 = 4

(B) Today is Friday.

(C) The 2008 Hulk movie is better than the 2003 Hulk movie.

(D) In Java, a boolean data type can store one of 3 values: true, false, or maybe.

Question 2

Which of the following is a Boolean statement?

(A) New York has the best operas.

(B) Paris is the capital of Texas.

(C) The Dallas Cowboys have the best football team.

(D) Kings and queens run better governments than presidents.

Question 3

Which of the following is shorthand notation for AND?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 4

Which of the following is the Java operator for AND?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 5

Which of the following is shorthand notation for OR?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 6

Which of the following is the Java operator for OR?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 7

Which of the following is shorthand notation for XOR?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 8

Which of the following is the Java operator for XOR?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 9

Which of the following is shorthand notation for NOT?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 10

Which of the following is the Java operator for NOT?

(A) + (E) &&(B) * (F) ||(C) ~ (G) !(D) ⊕ (H) !=

Question 11The rectangle represents all the students at JPIIHS.Let A = All of the students who are in athletics.Let B = All of the students who are in fine arts.

What does the chart on the right represent?

(a) All of the students who are in athletics.(b) All of the students who are NOT in athletics.(c) All of the students who are in athletics and/or fine arts.(d) All of the students who are in BOTH athletics & fine arts.(e) All of the students who are either in athletics, or fine arts,

BUT NOT BOTH.

Question 12The rectangle represents all the students at JPIIHS.Let A = All of the students who are in athletics.Let B = All of the students who are in fine arts.

What does the chart on the right represent?

(a) All of the students who are in athletics.(b) All of the students who are NOT in athletics.(c) All of the students who are in athletics and/or fine arts.(d) All of the students who are in BOTH athletics & fine arts(e) All of the students who are either in athletics, or fine arts,

BUT NOT BOTH.

Question 13The rectangle represents all the students at JPIIHS.Let A = All of the students who are in athletics.Let B = All of the students who are in fine arts.

What does the chart on the right represent?

(a) All of the students who are in athletics.(b) All of the students who are NOT in athletics.(c) All of the students who are in athletics and/or fine arts.(d) All of the students who are in BOTH athletics & fine arts.(e) All of the students who are either in athletics, or fine arts,

BUT NOT BOTH.

Question 14The rectangle represents all the students at JPIIHS.Let A = All of the students who are in athletics.Let B = All of the students who are in fine arts.

What does the chart on the right represent?

(a) All of the students who are in athletics.(b) All of the students who are NOT in athletics.(c) All of the students who are in athletics and/or fine arts.(d) All of the students who are in BOTH athletics & fine arts.(e) All of the students who are either in athletics, or fine arts,

BUT NOT BOTH.

Question 15The rectangle represents all the students at JPIIHS.Let A = All of the students who are in athletics.Let B = All of the students who are in fine arts.

What does the chart on the right represent?

(a) All of the students who are in athletics.(b) All of the students who are NOT in athletics.(c) All of the students who are in athletics and/or fine arts.(d) All of the students who are in BOTH athletics & fine arts.(e) All of the students who are either in athletics, or fine arts,

BUT NOT BOTH.

Question 16This program segment is from a college admissions program.

What would be the output after the user enters 1200 followed by 18?

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 || rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

(a) You are admitted.(b) You are not admitted.(c) Try another college.

Question 17This program segment is from a college admissions program.

What would be the output after the user enters 900 followed by 24?

(a) You are admitted.(b) You are not admitted.(c) Try another college.

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 || rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

Question 18This program segment is from a college admissions program.

What would be the output after the user enters 1100 followed by 30?

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 || rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

(a) You are admitted.(b) You are not admitted.(c) Try another college.

Question 19This program segment is from a college admissions program.

What would be the output after the user enters 1099 followed by 26?

(a) You are admitted.(b) You are not admitted.(c) Try another college.

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 || rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

Question 20This program segment is from a college admissions program.

What would be the output after the user enters 1600 followed by 1?

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 && rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

(a) You are admitted.(b) You are not admitted.(c) Try another college.

Question 21This program segment is from a college admissions program.

What would be the output after the user enters 1100 followed by 25?

(a) You are admitted.(b) You are not admitted.(c) Try another college.

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 && rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

Question 22This program segment is from a college admissions program.

What would be the output after the user enters 1500 followed by 10?

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 != rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

(a) You are admitted.(b) You are not admitted.(c) Try another college.

Question 23This program segment is from a college admissions program.

What would be the output after the user enters 1200 followed by 30?

(a) You are admitted.(b) You are not admitted.(c) Try another college.

System.out.print("Enter SAT score. ");int sat = Expo.enterInt();System.out.print("Enter class rank. ");int rank = Expo.enterInt();

if (sat >= 1100 != rank < 25)System.out.println("You are admitted.");

elseSystem.out.println("Try another college.");

Question 24

What is the output of this program segment?

double average = 90;if (x > 90)

System.out.println(“You earned an A.”);else if (x > 80)

System.out.println(“You earned a B.”);else if (x > 70)

System.out.println(“You earned a C.”);else

System.out.println(“You fail.”);

(a) You earned an A.(b) You earned a B.(c) You earned a C.(d) You fail.

Question 25

Which of the following will properly check to see if someone is between 21 and 100 years old?(Note: This includes the people who are 21 or 100.)

(a) if (age > 21 || age < 100)(b) if (age > 21 && age < 100)(c) if (age >= 21 || age <= 100)(d) if (age >= 21 && age <= 100)

Extra CreditWhat is the flag for this while loop?

boolean valid = false;while (!valid){

System.out.print("Enter grade: ");int grade = Expo.enterInt( );valid = (grade >= 0 && grade <= 100);

}

(a) The user enters a grade that is negative.(b) The user enters a grade that is positive.(c) The user enters a grade that is less than 100.(d) The user enters a grade between 0 and 100.