PreAP Computer Science Quiz

Slides:



Advertisements
Similar presentations
PreAP Computer Science Quiz
Advertisements

Hand Trace and Output for: int digit = 0; int number = 1423; do { digit = number % 10; System.out.println(digit); number = number / 10; } while (number.
1 Chapter 8 Objects and Classes Lecture 2 Prepared by Muhanad Alkhalisy.
AP Computer Science DYRT Quiz Key
Exercise 4 1. Write a program that simulates coin tossing. For each toss of the coin the program should print Heads or Tails. Let the program toss the.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
Chapter 4 Probability and Counting Rules Section 4-2
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
BUILDING JAVA PROGRAMS CHAPTER 7 Array Algorithms.
PreAP Computer Science Quiz
PreAP Computer Science Quiz
PreAP Computer Science Quiz
Graph Partitioning Problem Kernighan and Lin Algorithm
Linear Inequalities in Two Variables
PreAP Computer Science Quiz
Mathematics Arithmetic Series Science and Mathematics Education Research Group Supported by UBC Teaching and Learning Enhancement Fund Department.
Computer Science Reading Quiz 6.2 (Sections )
PreAP Computer Science Review Quiz 08 Key
Mathematics Arithmetic Sequences Science and Mathematics Education Research Group Supported by UBC Teaching and Learning Enhancement Fund Department.
PreAP Computer Science Quiz Key
My clicker is working. (T/F/not sure). I’m a vegetarian. (T/F/not sure)
PreAP Computer Science Quiz
COP 3275 – Iteration and loops Instructor: Diego Rivera-Gutierrez.
Bellwork: Binder Quiz Put your textbook away. Take out a ½ sheet of paper. Show all work, pictures, solution etc. for the following problems: 1. Pg. 7.
AP Computer Science DYRT Quiz Key
CSE 201 – Elementary Computer Programming 1 Extra Exercises Sourceshttp://
Output Programs These slides will present a variety of small programs. Each program has a control structure that was introduced in this chapter. Our concern.
Printing with for Loops To print a character multiple times, use a for loop. for (int j = 1; j
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output.
Chapter 4 Probability and Counting Rules Section 4-2
PreAP Computer Science Quiz
PreAP Computer Science Quiz Key
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA CSC141 Computer Science I 2/4/20161.
Midterm preview. double int = 2.0; True / FalseThe following is a syntactically correct variable declaration and assignment statement:
Take out a piece of paper and PEN.
PreAP Computer Science Quiz Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 30 – 60 seconds.
Output Programs These slides will present a variety of small programs. Each program has a compound condition which uses the Boolean Logic that was introduced.
AP Computer Science DYRT Quiz
1 Generating Random Numbers Textbook ch.6, pg
MR. CRONE Generating Random Numbers. Random Numbers Many programs require the computer to generate random numbers Random numbers are used in many applications.
Algorithm Definition An algorithm is a step-by-step solution to a problem.
Algorithm Definition An algorithm is a step-by-step solution to a problem.
Output Programs These slides will present a variety of small programs. Each program has a control structure that was introduced in this chapter. Our concern.
Question 01 Which of the following can be stored by a simple or primitive data type? (a)Only 1 single value (b)Only Attributes (c)Only Methods (d)Both.
Welcome Back to School Mr. Hagin a.k.a. Mr. Haginduff Course 3 and Geometry Room A140 Extension: 35532
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. Exposure Java 2014 for.
Computing Adjusted Quiz Total Score
Pre-AP® Computer Science Quiz Key
Pre-AP® Computer Science Quiz
Take out a piece of paper and PEN.
PreAP Computer Science Review Quiz 08
CS150 Introduction to Computer Science 1
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
PreAP Computer Science Quiz Key
Take out a piece of paper and PEN.
Click on the icon above to hear the narration.
PreAP Computer Science Quiz
Click on the icon above to hear the narration.
Take out a piece of paper and PEN.
Take out a piece of paper and PEN.
QUIZ 5 – RESULT.
Take out a piece of paper and PEN.
1st language words & bits 2nd language words & bits
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
Click on the icon above to hear the narration.
Pre-AP® Computer Science Quiz
Click on the icon above to hear the narration.
Presentation transcript:

PreAP Computer Science Quiz 13.01- 02 Take out a piece of paper and PEN. The quiz starts one minute after the tardy bell rings. You will have 30 – 60 seconds per question.

Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Quiz 13.01-02 1. 8. 2. 9. 3. 10. 4. 11. 5. 12. 6. 13. 7. 14. EC.

Question 01 An algorithm is a step-by-step solution to a problem. a mathematical solution to a problem. a program that creates poetry that rhymes. none of the above.

Question 02 The random method of the Expo class is a void class method. a void object method. a return class method. a return object method.

Question 03 The nextInt method of the Random class is a void class method. a void object method. a return class method. a return object method.

Question 04 What will this program segment display if it is executed twice? for (int j = 1; j <= 10; j++) System.out.println(Expo.random(1,1000); (a) 1st Execution: 10 Identical Numbers 2nd Execution: The same 10 Identical Numbers (b) 1st Execution: 10 Different Numbers 2nd Execution: The same 10 Different Numbers (c) 1st Execution: 10 Different Numbers 2nd Execution: A different set of 10 Different Numbers

Question 05 What will this program segment display if it is executed twice? Random rand = new Random(); for (int j = 1; j <= 10; j++) System.out.println(rand.nextInt(1000) + 1); (a) 1st Execution: 10 Identical Numbers 2nd Execution: The same 10 Identical Numbers (b) 1st Execution: 10 Different Numbers 2nd Execution: The same 10 Different Numbers (c) 1st Execution: 10 Different Numbers 2nd Execution: A different set of 10 Different Numbers

Question 06 What will this program segment display if it is executed twice? Random rand = new Random(4600); for (int j = 1; j <= 10; j++) System.out.println(rand.nextInt(1000) + 1); (a) 1st Execution: 10 Identical Numbers 2nd Execution: The same 10 Identical Numbers (b) 1st Execution: 10 Different Numbers 2nd Execution: The same 10 Different Numbers (c) 1st Execution: 10 Different Numbers 2nd Execution: A different set of 10 Different Numbers

Question 07 What will this program segment display if it is executed twice? Random rand = new Random(4600); int x = rand.nextInt(1000) + 1; for (int j = 1; j <= 10; j++) System.out.println(x); (a) 1st Execution: 10 Identical Numbers 2nd Execution: The same 10 Identical Numbers (b) 1st Execution: 10 Different Numbers 2nd Execution: The same 10 Different Numbers (c) 1st Execution: 10 Different Numbers 2nd Execution: A different set of 10 Different Numbers

Question 08 Random rand = new Random(4600); Which part of the statement below is the random seed? Random rand = new Random(4600); rand new 4600 The 1st Random The 2nd Random

Question 09 Random rand = new Random(); What is the output of this program segment? Random rand = new Random(); System.out.println(rand.nextInt(5000)); a random number between 0 and 5000 a random number between 0 and 4999 a random number between 1 and 5000 a random number between 1 and 4999 a random number between 1 and 5001

Question 10 Random rand = new Random(); What is the output of this program segment? Random rand = new Random(); System.out.println(rand.nextInt(5000) + 1); a random number between 0 and 5000 a random number between 0 and 4999 a random number between 1 and 5000 a random number between 1 and 4999 a random number between 1 and 5001

Question 11 Random rand = new Random(); What is the output of this program segment? Random rand = new Random(); System.out.println(rand.nextInt(301) + 500); a random number between 300 and 500 a random number between 301 and 500 a random number between 301 and 801 a random number between 500 and 800 a random number between 500 and 801

Question 12 Random rand = new Random(); Which of the following statements can replace the mystery code to display a random # from 0 to 400? Random rand = new Random(); System.out.println( mystery code ); rand.nextInt(399) rand.nextInt(400) rand.nextInt(399) + 1 rand.nextInt(400) + 0 rand.nextInt(401)

Question 13 Random rand = new Random(); Which of the following statements can replace the mystery code to display a random # from 30 to 70? Random rand = new Random(); System.out.println( mystery code ); rand.nextInt(30) + 70 rand.nextInt(70) + 30 rand.nextInt(40) + 30 rand.nextInt(41) + 30 rand.nextInt(41) + 70

Question 14 Random rand = new Random(); Which of the following statements can replace the mystery code to display a random 5-digit number? Random rand = new Random(); System.out.println( mystery code ); rand.nextInt(99999) + 10000 rand.nextInt(10000) + 99999 rand.nextInt(90000) + 10000 rand.nextInt(89999) + 10000 rand.nextInt(100000)

Extra Credit Random rand = new Random(); What is the output of this program segment? Random rand = new Random(); System.out.println(rand.nextInt(21) – 10); a random number between -10 and 21 a random number between -21 and 10 a random number between -10 and 10 a random number between -21 and 21 a random number between -10 and 9 17