Chapter 1 Quiz

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

Which of the following statements is correct to display Welcome to Java on the console? A. System.out.println('Welcome to Java'); B. System.out.println("Welcome to Java"); C. System.println('Welcome to Java'); D. System.out.println('Welcome to Java"); E. System.out.println("Welcome to Java');

B

Which of the following statements is correct? A. Every line in a program must end with a semicolon. B. Every statement in a program must end with a semicolon. C. Every comment line must end with a semicolon. D. Every method must end with a semicolon. E. Every class must end with a semicolon.

B

Every statement in Java ends with ________

A semicolon ( ; )

The JDK command to compile a class in the file Test.java is: A. java Test B. java Test.java C. javac Test.java D. javac Test E. JAVAC Test.java

C

The main method header is written as: A. public static void main(string[ ] args) B. public static void Main(String[ ] args) C. public static void main(String[ ] args) D. public static main(String[ ] args) E. public void main(String[ ] args)

C

________ is not an object-oriented programming language A) Java B) C++ C) C D) C# E) Python

C

____________ is an operating system A) Java B) C++ C) Windows D) Visual Basic E) Ada

C

_______ 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

_______ provides an integrated development environment (IDE) for rapidly developing Java programs. Editing, compiling, building, debugging, and online help are integrated in one graphical user interface

Java IDE

________ is a technical definition of the language that includes the syntax and semantics of the Java programming language

Java language specification

_________ is a software that interprets Java bytecode

Java virtual machine

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

Operating system

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.java

Due to security reasons, Java ___________ cannot run from a Web browser in the new version of Java

applets

Computer can execute the code in ____________

machine language

The speed of the CPU may be measured in __________

megahertz and gigahertz

One byte has ________ bits

8 bits

Which JDK command is correct to run a Java application in ByteCode.class? A. java ByteCode B. java ByteCode.class C. javac ByteCode.java D. javac ByteCode E. JAVAC ByteCode

A

_______ is architecture-neutral A) Java B) C++ C) C D) Ada E) Pascal

A

________ is interpreted A) Java B) C++ C) C D) Ada E) Pascal

A

___________ translates high-level language program into machine language program

A compiler

Analyze the following code. I: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } II: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } A. Both I and II can compile and run and display Welcome to Java, but the code in II has a better style than I. B. Only the code in I can compile and run and display Welcome to Java. C. Only the code in II can compile and run and display Welcome to Java. D. Both I and II can compile and run and display Welcome to Java, but the code in I has a better style than II.

D

Which of the following is not permanent storage devices? A) floppy disk B) hard disk C) flash stick D) CD-ROM E) main memory

E

The extension name of a Java bytecode file is

.class

The extension name of a Java source code file is

.java

Which of the following are the reserved words? A. public B. static C. void D. class

A, B, C, and D

Why do computers use zeros and ones?

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

A block is enclosed inside __________

Braces

Programming style is important, because ______________. A. a program may not compile if it has a bad style B. good programming style can make a program run faster C. good programming style makes a program more readable D. good programming style helps reduce programming errors

C and D

Which of the following lines is not a Java comment? A. /** comments */ B. // comments C. -- comments D. /* comments */ E. ** comments **

C and E

________ is the brain of the computer

CPU

________ is the physical aspect of the computer that can be seen.

Hardware

Which of the following code has the best style? I: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } II: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } III: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } IV: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } }

IV

________ contains predefined classes and interfaces for developing Java programs

Java API

____________ is a device to connect a computer to a local area network (LAN)

Network Interface Card (NIC)

____________ are instructions to the computer

Software and Programs

Java was developed by ____________

Sun Microsystems

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

a compile error

If a program compiles fine, but it produces incorrect result, then the program suffers _________

a logic error


Ensembles d'études connexes

Chapter 23 Allergic Reaction PreTest

View Set

CompTIA A+ 1102 exam Practice Test 4

View Set

Chapter 22: Imperialism and Colonialism, 1870-1914

View Set

COSC: 11.6 Scope of variable/method definitions

View Set