CS 109: Programming Definition, Software & Languages_Chapter_1_Lesson_11

Ace your homework & exams now with Quizwiz!

The compiler is giving an error on the following statement. Why? float hoursWorked = 40 1. Missing a variable 2. Missing a value 3. Missing semicolon 4. Missing brackets

All Java statements must end in a semicolon (;). All Java statements must end in a semicolon (;). All Java statements must end in a semicolon (;). All Java statements must end in a semicolon (;).

A Java statement can be thought of as which one of the following? 1. A prompt 2. An expression 3. An instruction 4. A loop

An instruction. An instruction. An instruction. Java statements are instructions that tell the programming language what to do. Java statements are instructions that tell the programming language what to do.

What type of statement is the following? int marker = 10; 1. Control 2. Void 3. Assignment 4. Intege

Assignment statement. Assignment statement. Assignment statement. Assignment statement. Assignment statement. Assignment statement.

Examine the following code. What is missing on the ''if statement''? if(ticker > 15) System.out.println("Over the limit!"); 1. An ''else statement'' 2. Brackets/braces 3. A semicolon 4. An ''end if'' statement

Brackets/braces. Brackets/braces. Brackets/braces. An if statement begins with an opening bracket, includes some statements, and ends with a closing bracket. An if statement begins with an opening bracket, includes some statements, and ends with a closing bracket.

The static keyword indicates that the main method is a _____ method. 1. Empty 2. Main 3. Void 4. Class

Class is a method. Class is a method. Class is a method. Class is a method. Class is a method. Class is a method. Class is a method. Class is a method. Class is a method.

What happens when you compile and run the following Java program? class HelloWorld { public static void main(String[] args) { System.out.println("Goodbye!") } HelloWorld is printed on the screen Goodbye is printed on the screen Nothing is printed on the screen There is an error during compiling

Nothing is printed on the screen. Nothing is printed on the screen. Nothing is printed on the screen. will cause an error during compilation because there is no ; semi-colon. will cause an error during compilation because there is no ; semi-colon.

In the statement, what does the public statement mean? 1. Other objects can use/call the method 2. The method can't be used in a class 3. No other methods can use the method 4. The method can return a value

Other objects can use/call the method. Other objects can use/call the method. Other objects can use/call the method. Other objects can use/call the method. Other objects can use/call the method.

Which code statement will compile? public class Main { public static void main(String args) { System.out.println("On the Bounding Main!"); } }

The keyword public static void main is the means by which you create a main method within the Java application. The keyword public static void main is the means by which you create a main method within the Java application.

What does the void keyword mean in the public static void main statement? 1. The method returns only NULL values 2. The method is empty 3. The method returns values 4. The method cannot return a value

The method cannot return a value. The method cannot return a value. The method cannot return a value. The method cannot return a value. The method cannot return a value.

What will happen if you do not include a main method (e.g., public static void main)? 1. The program may run but will not compile 2. The program may not compile 3. The program will compile with errors 4. Nothing; the program will compile normally

The program may not compile. The program may not compile. The program may not compile. The program may not compile. The program may not compile. The program may not compile.

What happens when you compile and run the following Java program? class WelcomeWorld{ public static void main(String args) { System.out.println("HelloWord"); }} 1. Nothing is printed on the screen 2.There is an error when compiling 3. WelcomeWorld is printed on the screen 4. HelloWorld is printed on the screen

There is an error when compiling. There is an error when compiling. There is an error when compiling. There must be an opening and closing square bracket following 'String'. There must be an opening and closing square bracket following 'String'.

What will the following program print on the screen? /* The Hello World Program Prints Hello World! on the computer screen*/ class HelloWorld{ Public static void main(String[] args) { System.out.println('Welcome,World!'); } 1. HelloWorld 2. Welcome, World! 3. This code will not compile. 4. Hello, World! 5. WelcomeWorld

This code will not compile. This code will not compile. but it needs to be in double quotes (") so this will not compile. ''Public'' should also be written in all lower case letters. but it needs to be in double quotes (") so this will not compile. ''Public'' should also be written in all lower case letters.

Which of the following is a correctly written Java statement? 1. while(f<3); 2. new String = "Joey" 3. double conversion = 15.34; 4. for(int i =0; i<15;i++)

double conversion = 15.34; double conversion = 15.34; double conversion = 15.34; double conversion = 15.34; A basic statement, like an assignment statement, assigns a value to a variable. A basic statement, like an assignment statement, assigns a value to a variable.

How would you compile the following Java program? class WelcomeWorld{ public static void main(String[] args) { System.out.println("HelloWorld"); } 1. javac WelcomeWorld.java 2. javac Welcome World.java 3. javac HelloWorld.java 4. javac HelloWorld!.java

javac WelcomeWorld.java. javac WelcomeWorld.java. In Java, you compile a program by calling the class by its name. In Java, you compile a program by calling the class by its name. In Java, you compile a program by calling the class by its name.

What will the following Java program print on the screen? /* * The HelloWorld Java program * prints "Hello World!" on the computer screen */ public class Main{ public static void main(String[] args) { ; } } 1. /* print 'Goodbye!'*/ 2. Goodbye 3. Print Goodbye 4. nothing will be printed on the screen

nothing will be printed on the screen. nothing will be printed on the screen. nothing will be printed on the screen. Also there is no println statement. So there will be nothing printed on the screen. Also there is no println statement. So there will be nothing printed on the screen.


Related study sets

Differentiation & Technology ED448S

View Set

Legal and ethical issues in counseling

View Set

Chapter 14: Fraud Against Organizations

View Set