CS4A Ch.1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following code has the best style? https://snag.gy/jZC4fV.jpg I II III IV

IV

________ is a program that runs on a computer to manage and control a computer's activities.

Operating system

Which of the following are the reserved words?(Multi) public static void class

public static void class

The extension name of a Java bytecode file is ________. .java .obj .class .exe

.class

__________ translates high-level language program into machine language program.

A compiler

A Java application must have a main method. True False

True

A Java program block starts with an open brace ({) and ends with a closing brace (}). True False

True

Java source code can be executed on a Java Virtual Machine. true false

false

You use ________ to run a Java program.

java

Computer can execute the code in ________. machine language assembly language high-level language None of these

machine language

The _________ must be the same as the filename that contains the class.

public classname

Which of the following lines is not a Java comment? (multi) /*** comments */ // comments -- comments /** comments **/ *** comments ***

-- comments *** comments ***

Why do computers use zeros and ones? -because combinations of zeros and ones can represent any numbers and characters. -because digital devices have two stable states and it is natural to use one state for 0 and the other for 1. -because binary numbers are simplest. -because binary numbers are the bases upon which all other number systems are built.

-because digital devices have two stable states and it is natural to use one state for 0 and the other for 1.

Programming style is important, because ________. (multiptle) -a program may not compile if it has a bad style -good programming style can make a program run faster -good programming style makes a program more readable -good programming style helps reduce programming errors

-good programming style makes a program more readable -good programming style helps reduce programming errors...

The extension name of a Java source code file is ________. .java .obj .class .exe

.java

Four bytes have ________ bits. 8 16 32 64

32

One byte has ________ bits. 4 8 12 16

8

https://snag.gy/eN4VCI.jpg Both I and II can compile and run and display Welcome to Java, but the code in II has a better style than I. Only the code in I can compile and run and display Welcome to Java. Only the code in II can compile and run and display Welcome to Java. Both I and II can compile and run and display Welcome to Java, but the code in I has a better style than II.

Both I and II can compile and run and display Welcome to Java, but the code in I has a better style than II.

________ contains predefined classes and interfaces for developing Java programs.

Java API

________ consists of a set of separate programs for developing and testing Java programs, each of which is invoked from a command line.

Java JDK

Java compiler translates Java source code into ________.

Java bytecode

A ________ is a program that translates Java source code into Java bytecode.

Java interpreter

________ is a software that interprets Java bytecode.

Java virtual machine

________ are instructions to the computer. (multi) Hardware Software Programs Keyboards

Software Programs

Which of the following statements is correct to display Welcome to Java on the console? (multi) System.out.println('Welcome to Java'); System.out.println("Welcome to Java"); System.println('Welcome to Java'); System.out.print('Welcome to Java'); System.out.print("Welcome to Java");

System.out.println("Welcome to Java"); System.out.print("Welcome to Java");

Suppose you define a Java class as follows: public class Test { } In order to compile this program, the source code should be stored in a file named ________. Test.class Test.doc Test.txt Test.java Any name with extension .java

Test.java

If you forget to put a closing quotation mark on a string, what kind error will be raised? a compilation error a runtime error a logic error

a compilation error

If a program compiles fine, but it produces incorrect result, then the program suffers ________ a compilation error a runtime error a logic error

a logic error

Every statement in Java ends with ________. a semicolon (;) a comma (,) a period (.) an asterisk (*)

a semicolon (;)

A block is enclosed inside ________. parentheses braces brackets quotes

braces

The ________ loads Java bytecode to the memory. Java virtual machine bytecode verifier class loader Java compiler

class loader

The compiler generates bytecode even if the program has syntax errors. true false

false

The keywords in Java are all in lowercase. true false

false

Which JDK command is correct to run a Java application in ByteCode.class? java ByteCode java ByteCode.class javac ByteCode.java javac ByteCode JAVAC ByteCode

java ByteCode

type in the JDK command to compile the class MyFirstProgram.

javac MyFirstProgram.java

The JDK command to compile a class in the file Test.java is ________. java Test java Test.java javac Test.java javac Test JAVAC Test.java

javac Test.java

The command to compile a class in the file Test.java is ________. java Test java Test.java javac Test.java javac Test JAVAC Test.java

javac Test.java

The main method header is written as ________. public static void main(string[] args) public static void Main(String[] args) public static void main(String[] args) public static main(String[] args) public void main(String[] args)

public static void main(String[] args)

Java is an object-oriented programming language. true false

true


Ensembles d'études connexes

Chapter 8: Introduction to Health Insurance

View Set

AP Computer Science Test - Unit 2

View Set

Financial Accounting Ch. 4 Notes

View Set

II Lecture Chapter 13 True-False Exercise 13.05

View Set