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.

Slides:



Advertisements
Similar presentations
Introduction to Computer Science Robert Sedgewick and Kevin Wayne Recursive Factorial Demo pubic class Factorial {
Advertisements

PreAP Computer Science Quiz
Computer Programming Lab(4).
תרגול 12 מעקב אובייקטים 1. Our exams material : Course Syllabus : includes all the material.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
The for-statement. Different loop-statements in Java Java provides 3 types of loop-statements: 1. The for-statement 2. The while-statement 3. The do-while-statement.
PreAP Computer Science Quiz
Sadegh Aliakbary Sharif University of Technology Spring 2011.
PreAP Computer Science Quiz
PreAP Computer Science Quiz
Computer Science Reading Quiz 6.2 (Sections )
PreAP Computer Science Review Quiz 08 Key
1 Conditionals Instructor: Mainak Chaudhuri
PreAP Computer Science Quiz Key
October 28, 2015ICS102: For Loop1 The for-loop and Nested loops.
Computer Programming 12 Mr. Jean April 24, The plan: Video clip of the day Upcoming Quiz Sample arrays Using arrays More about arrays.
Peyman Dodangeh Sharif University of Technology Spring 2014.
PreAP Computer Science Quiz
AP Computer Science DYRT Quiz Key
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.
PreAP Computer Science Quiz
PreAP Computer Science Quiz Key
PreAP Computer Science Quiz
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
Take out a piece of paper and PEN.
Classes - Intermediate
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.
A Introduction to Computing II Lecture 1: Java Review Fall Session 2000.
CS001 Introduction to Programming Day 6 Sujana Jyothi
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.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
AP Computer Science DYRT Quiz
Computer Science I Lab 1 ISMAIL ABUMUHFOUZ | CS 180.
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.
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.
Department of Computer Science
Sum of natural numbers class SumOfNaturalNumbers {
TK1114 Computer Programming
Something about Java Introduction to Problem Solving and Programming 1.
Advanced Programming in Java
مفاهیم اولیه زبان جاوا Java Basic Concepts
Writing Methods.
Computing Adjusted Quiz Total Score
TO COMPLETE THE FOLLOWING:
Pre-AP® Computer Science Quiz Key
Pre-AP® Computer Science Quiz
Java so far Week 7.
Recursive GCD Demo public class Euclid {
Take out a piece of paper and PEN.
References and Objects
class PrintOnetoTen { public static void main(String args[]) {
PreAP Computer Science Review Quiz 08
PreAP Computer Science Quiz Key
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
if-else if (condition) { statements1 } else { statements2
Methods and Data Passing
Scope of variables class scopeofvars {
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
while while (condition) { statements }
Take out a piece of paper and PEN.
PreAP Computer Science Quiz
Take out a piece of paper and PEN.
Take out a piece of paper and PEN.
Scope scope: The part of a program where a variable exists. From its declaration to the end of the { } braces A variable declared in a for loop exists.
Take out a piece of paper and PEN.
AP Computer Science DYRT Quiz
Take out a piece of paper and PEN.
6.2 for Loops Example: for ( int i = 1; i
Pre-AP® Computer Science Quiz
Instructor: Mainak Chaudhuri
Presentation transcript:

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 for each question. PreAP Computer Science Output Quiz 05

Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Output Quiz EC.

What is the output of this program? public class Question01 { public static void main(String args[]) { for (int k = 1; k <= 10; k++) System.out.print(k + " "); } (a) (b) (c) (d)

What is the output of this program? public class Question02 { public static void main(String args[]) { for (int k = 1; k < 10; k++) System.out.print(k + " "); } (a) (b) (c) (d)

What is the output of this program? public class Question03 { public static void main(String args[]) { for (int k = 0; k <= 10; k+=2) System.out.print(k + " "); } (a) (b) (c) (d)

What is the output of this program? public class Question04 { public static void main(String args[]) { for (int k = 1; k <= 10; k+=2) System.out.print(k + " "); } (a) (b) (c) (d)

What is the output of this program? public class Question05 { public static void main(String args[]) { for (int k = 3; k < 50; k*=2) System.out.print(k + " "); } (a) (b) (c) (d)

What is the output of this program? public class Question06 { public static void main(String args[]) { for (int k = 12345; k >= 10; k /= 10) System.out.print(k + " "); } (a) (b) (c) (d)

What is the output of this program? public class Question07 { public static void main(String args[]) { double x = 3.5; if (x < 5.0) System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question08 { public static void main(String args[]) { double x = 7.5; if (x < 5.0) System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question09 { public static void main(String args[]) { char c = 'J'; c++; if (c == 'J') System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question10 { public static void main(String args[]) { char c = 'K'; c--; if (c == 'J') System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question11 { public static void main(String args[]) { double x = 3.5; if (x < 5.0) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question12 { public static void main(String args[]) { double x = 7.5; if (x < 5.0) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question13 { public static void main(String args[]) { double x = 2.9; if (x > 2.9) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question14 { public static void main(String args[]) { double x = 2.9; if (x >= 2.9) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

What is the output of this program? public class Question15 { public static void main(String args[]) { int x,y; x = y = 10; x++; y += x; x *= 2; System.out.println(x – y); } (a) 43(b) 22(c) 21 (d) 11(e) 1(f) -1

What is the output of this program? public class Question16 { public static void main(String args[]) { int x,y; x = y = 10; y++; x += y; y *= 2; System.out.println(y + x); } (a) 43(b) 22(c) 21 (d) 11(e) 1(f) -1

What is the output of this program? public class Question17 { public static void main(String args[]) { int x = 5; while (x <= 10) x++; System.out.println(x); } (a) 5 (b) 7(c) 9 (d) 10(e) 11(f) 12

What is the LAST output of this program? public class Question18 { public static void main(String args[]) { int x = 5; while (x < 10) { x+=2; System.out.println(x); } (a) 5 (b) 7(c) 9 (d) 10(e) 11(f) 12

What is the output of this program? public class Question19 { public static void main(String args[]) { int x = 20; int y = 2; int z = 3; while (x > y + z) { x--; y += z; z += y; } System.out.println(z); } (a) 5(b) 13(c) 18(d) 21

What is the flag in this program? public class Question20 { public static void main(String args[]) { int x = 0; while (x >= 0) x = Expo.enterInt(); } (a)0 (b)any positive number (c)any positive number and 0 (d)any negative number

public class ExtraCredit { public static void main(String args[]) { int sum = 0; for (int k = 1 ; k <= 10; k++) k = k + k; System.out.println(sum); } (a)0 (b)10 (c)14 (d)16 (e)20 (f)32