Ch 1

Ace your homework & exams now with Quizwiz!

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!"); } }

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

Which of the following lines is not a Java comment? (choose all that apply)

** comments ** -- comments

Which of the following lines is not a Java comment?

-- comments *** comments ***

The extension name of a Java bytecode file is

.class

The extension name of a Java bytecode file is ________.

.class

The extension name of a Java source code file is

.java

________ translates high-level language program into machine language

A compiler

________ is a software that interprets Java bytecode.

Java virtual machine

The speed of the CPU is measured in ________. (choose all that apply)

Megahertz Gigahertz

________ is a device to connect a computer to a local area network

NIC

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

NIC

Java ________ can run from a Web browser.

applets

The main method header is written as:

public static void main(String[] args)

Which of the following statements is correct to display Welcome to Java on the console? (choose all that apply)

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

A Java application must have a main method.

True

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

True

Java is an object-oriented programming language.

True

Java was originally developed by a team led by James Gosling at Sun Microsystems.

True

The keywords in Java are all in lowercase.

True

The public classname must be the same as the filename that contains the class.

True

________ is an operating system.

Windows XP

Every statement in Java ends with ________.

a semicolon (;)

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

The ________ loads Java bytecode to the memory.

class loader

Which of the following are storage devices?

floppy disk hard disk flash stick CD-ROM

You use ________ to run a Java program

java

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

java ByteCode

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

javac Test.java

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

javac Test.java

Computer can execute the code in ________.

machine language

Which of the following are the reserved words? (choose all that apply)

void public static class

The extension name of a Java source code file is ________.

.java

The decimal value 16 is ________ in hex.

10

The decimal value 5 is ________ in binary.

101

Decimal number 10 is binary number ________.

1010

Hexadecimal number A1 is binary number ________.

10100001

The binary representation of decimal 49 is ________.

110001

The hex value 7A is ________ in binary.

1111010

The binary value 10011 is ________ in hex.

13

Decimal number 20 is hexadecimal number ________.

14

Hexadecimal number A1 is decimal number ________.

161

The hex value 1A is ________ in decimal.

26

Four bytes have ________ bits.

32

One byte has ________ bits.

8

Binary number 1001 is decimal number ________.

9

Binary number 1001 is hexadecimal number ________.

9

The binary value 1001 is ________ in decimal.

9

Which of the following statements is true?

A Java applet can be executed from a Web browser

A block is enclosed inside ________.

Braces

________ is the brain of a computer.

CPU

Which of the following statements is correct?

Every statement in a program must end with a semicolon.

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

False

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

False

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

False

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

Hardware

The ________ method displays a message dialog box. (choose all that apply)

JOptionPane.showMessageDialog(null, "Welcome to Java!"); JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2 Output", JOptionPane.INFORMATION_MESSAGE);

________ is Architecture-Neutral.

Java

________ is interpreted.

Java

________ is an object-oriented programming language. (choose all that apply)

Java C++

________ contains predefined classes and interfaces for developing Java

Java API

________ contains predefined classes and interfaces for developing Java programs.

Java API

________ 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

________ 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

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

Java language specification

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

Operating system

________ are instructions to the computer. (choose all that apply)

Programs Software

________ are secondary storage. (choose all that apply)

RAM CD floppy disk

Java was developed by ________.

Sun Microsystems


Related study sets

Chapter 16: Auditing Operations and Completing the Audit

View Set

Trail Guide Spine and Thorax review questions

View Set

Lección 14 ¿Cómo pagas? ; Tu empresa

View Set

1. Introduction to C++ (Great Courses)

View Set

Global Chapter 30 Test--Cold War and China

View Set

Ch. 5 Conflict and Absolutism in Europe

View Set

MIS515 - Week 4 - Continuity Planning

View Set