CS Exam 1 (Practice It! & Quizzes)

¡Supera tus tareas y exámenes ahora con Quizwiz!

Is $Hello or 12MyCAr a valid identifier/name in java

$Hello

When a Java program is complied, which one of the following files will be created?

.class

What is the difference between the file MyProgram.java and the file MyProgram.class?

.java is a source code file typed by the programmer .class is a compiled executable class file that is run by the computer

By convention the main method in a java program should be declared as 1. the very first method 2. the very last method 3. the very first method or the very last method 4. anywhere in the code

3

How many spaces will be displayed between the words "today", "is" , " a" , " sunny", "day" after execution of the following java statement. Assume that \t provides 8 spaces System.out.println("Today\tis\ta\tsunny\tday"); Enter the number of the spaces separated by only one space otherwise your answer will be marked an incorrect. You need to enter 4 numbers.

3 6 7 3

Which one of the following is the correct way to write the main method in a java class? a. public void static main(String[] args) b. public static void main(String[] args) c. public main static void (String[] args) d. none of the answers

B

The order of writing methods is important. The main method must be the first method in your code (T/F)

False

What is the output of the following code segment System.out.print("Java"); System.out.println("Programming");

JavaProgramming

The process of building up a complete working program piece by piece is known as:

Procedural decomposition

Review Questions 8, 12, 13, 14 from Q3

Too complicated to make a card for

Every Java program must have a public class. (T/F)

True

The run of a java program starts from the main method.(T/F)

True

a method can be called in another method other than the main method (T/F)

True

comments are ignored by the Java compiler. (T/F)

True

A method call is:

a command to call another method

which one of the following lists all the escape sequence characters? a. \t, \n, \", \\ b. \t, \\ c. \t, \n d. \\, \"

a. \t, \n, \", \\

which one of the following is a valid java identifier? a. max_value b. %taxRate c. 123Car d. hook&laddera. max_value

a. max_value

Which of the following is the correct syntax for a method header? a. public static void m1() b. public void static m1() c. public static m1() d. public void m1()

a. public static void m1()

Static methods help to all the answers make the code more readable make the code reusable remove redundancy

all the answers

which one of the following is not a valid java identifier? a. Factorial b. highest$_ c.2ndLevel d. level2

c. 2ndLevel

Which one of the following is not the correct way to include comments in your code? a. /*Name: Mary*/ b. \hello\ c. all of the answers d. //date: 8/27

c. \hello\

Fill in the blank: make sure to have the correct spelling otherwise your answer will be marked incorrect Do not include any dot in your answer. Java source file or a java program has the __________ extension

java

if a program has a logical error

program compiles, runs but does not generate the proper output.

Review Questions 13 and 14 of Q2

too long and complicated to make into card

What will be displayed by the following statement? System.out.println("use a \"\\\"");

use a "\"


Conjuntos de estudio relacionados

Math Praxis (practice test and answers)

View Set

Forensic Evidence- unit 2-book notes

View Set

MAN. 3600 International Business Exam 2

View Set

Year 11 Economics Price and Non Price Competition - Internal Part 2

View Set