Quiz1 - For the following expressions, tell the result of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Name_____________________ (2)What is a type? Define type in your own words and give an example of a type in Java. (3) In the following statement, three things happen: declaration, allocation, and assignment. Draw a circle around the portion that corresponds to each of those three parts and label it. Scanner userInput = new Scanner(System.in); (3) Write a line of code that prints out “I know how to program a computer!” to the screen. (3) Write a line of code that reads an integer from the keyboard and places it into a variable named “num”, given that “Scanner userInput = new Scanner(System.in)” appeared earlier in the program. (3 pts each)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: For the following expressions, tell the result of the calculation Hello + friend Hello + 4 + friends 7 / 3 6 % 4 3.0 / 6.0 1 + 5 * 3 / 2 - 1 (5 pts) On the lines below, write what this program prints out to the screen. int A, B; A = 4; B = 7; if ((A / 2)*2 == A) System.out.println(A is well-behaved.); if (A < B) A = 8; if (A > B) System.out.println(A is larger than B); else System.out.println(A is smaller than B); Output: ______________________________________ ______________________________________ ______________________________________ ______________________________________...
View Full Document

This note was uploaded on 12/27/2011 for the course CMPSC 5 taught by Professor Franklin during the Fall '09 term at UCSB.

Page1 / 2

Quiz1 - For the following expressions, tell the result of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online