Java Chapter 1 Review

Post on 21-Jan-2016

67 views 0 download

description

Java Chapter 1 Review. How does Java handle identifiers that are the same word but typed in upper or lower case? 10 points. They are considered different identifiers because Java is case-sensitive. What is the relationship of the file name and the class identifier name? 20 points. - PowerPoint PPT Presentation

transcript

Java Chapter 1 ReviewNames &

IdentifiersErrors &

Binary #’sHardware & Networks

Misc. I Misc. II

10 10 10 10 10

20 20 20 20 20

30 30 30 30 30

40 40 40 40 40

50 50 50 50 50

How does Java handle identifiers that are the same word but typed in upper or lower case?10 points

They are considered different identifiers because Java is case-sensitive.

What is the relationship of the file name and the class identifier name?20 points

The two names must be the exact same in order to compile and run properly.

Is the following identifier legal, if no then why?$_totalPrice230 points

This identifier is just fine.

Is the following identifier legal, if no then why?strFirst&Last_Name 40 points

This identifier is bad because it uses the & symbol and that is not allowed.

What are all the rules for creating identifiers in the Java language?50 points

Any combination of letters, digits, the underscore and the dollar sign are allowed but the first character can’t start with a digit.

Convert the Base 2 number 1001 0011 to a Base 10 number without electronic help.10 points

Base 10 = 147

Convert the Base 10 number 193 to a Base 2 number without electronic help.20 points

Base 2 = 1100 0001

What are the three types of programming errors and explain each of the three.30 points

Compile – A syntax error, can’t compile.

Run-Time – Program compiles, but crashes when it runs.

Logic error- Output is not what is expected

List the error(s) & there type in the following code.

/*This programs adds two numbers together/*public class junk { public static void maine(String args[]) answer = 1number / 2number; System.out.println("The answer is); system.out.println(answer) }//end of maine method}/end of junk class40 points

Multiple line comment is wrong, main is spelled wrong, missing { for main, identifier is wrong, / instead of +, missing “ mark, missing ;

List how many unique items can be created with a 5 bit number.50 points

25 = 32

Temporary holding location for data while programs are running. Data is lost once computer is shut down.10 points

What is RAM

A group of computers that is networked together in a generally small area.20 points

What is a LAN

List a unit of measurement that is used for comparing each of the following devices.RAM – Hard Drive –CPU –Monitor -30 points

RAM, Hard Drive – Bytes

CPU – Hertz

Monitor – Inches on the diagonal

List three devices that hold data even after a computer is shutdown and that are referred to as secondary memory devices.40 points

Hard drive, USB key, CD, DVD, Tape, Floppy etc…

The dominate protocol that is used in networks that allow computers to communicate with each other.50 points

TCP/IP

What two components come with the Java SE version 6 and what is their general function?10 points

The JRE – The Java Runtime Environment, the virtual computer that allows your program to run on whatever system it is installed on.

The JDK – The Java Development Kit, allows you to compile Java programs.

Explain the difference between the following two files and explain how each was created.MyProgram.javaMyProgram.class20 points

The .java file is the edit file and has the source code created in some editor.

The .class file is the bytecode and was created by javac’ing the .java file.

Why don’t you have to compile a Java program differently for each computer system?30 points

Java is architectural neutral, the JRE takes the code and translate it to work for whatever system the JRE is installed on.

Convert 356,000 KB to each of the following:Bytes:GB:MB:40 points

356,000,000 Bytes

.356 Gbytes

356 MBytes

What is a method?50 points

A method is like a VB procedure or function, and is collection of programs statements that is given a name that can be called and executed.

How do you create single line comments and multiple line comments in Java?10 points

For single line use //

For multiple line use /* blah */

What are reserved words in Java?20 points

Words that are used in the syntax of the Java language. Java commands. You are not allowed to use these words as identifiers.

A Java application can contain multiple classes, but exactly one of the classes must contain what method?30 points

The main method

How much information does one address of RAM hold?40 points

One Byte

What is the term we used for proper indentation and spacing out your code?50 points

What is white space.