What tool translates Java source code into files that contain instructions for the Java Virtual Machine quizlet?

Which of the following refers to a collection of programs that a computer executes?

a) Software
b) Assembler
c) Instructions
d) Source code

a) software

Computers are machines that

a) design computer programs.
b) execute programs.
c) carry out a very narrow range of tasks.
d) are imprecise and slow

b) execute programs.

Computer programming is

a) the speed with which a computer operates.
b) the collection of peripheral devices connected to a computer.
c) the storage of data in the form of words and pictures.
d) the act of designing and implementing a computer program.

d) the act of designing and implementing a computer program

Consider the following statements regarding computers:

I. Computers can execute a large number of instructions in a fraction of a second.
II. Computer application areas mainly target the research and scientific communities.
III. The physical components of a computer constitute its hardware.
IV. Unlike humans, a computer never gets bored or exhausted when performing repetitive tasks.

Which one of the following options is correct?

a) Only III is a valid statement.
b) I and III only are valid statements.
c) I, II, and III only are valid statements.
d) I, III, and IV only are valid statements.

d) I, III, and IV only are valid statements.

Consider the following statements about computer programs:

I. Computer programs can be written by someone who has a basic knowledge of operating a computer.
II. Computer programs can complete complex tasks quickly.
III. Large and complex computer programs are generally written by a group of programmers.
IV. Computer programs are composed of extremely primitive operations.

Which one of the following options is correct?

a) II and III only are correct statements.
b) I, II, III and IV are correct statements.
c) II, III, and IV only are correct statements.
d) I and IV only are correct statements.

c) II, III, and IV only are correct statements.

The Central Processing Unit is primarily responsible for

a) performing program control and data processing.
b) ensuring data persists when electrical power is turned off.
c) enabling a human user to interact with the computer.
d) interconnecting computers that are separated by distance.

a) performing program control and data processing.

A single silicon chip made from potentially millions of transistors is called

a) a Central Processing Unit (CPU).
b) secondary Storage.
c) a Hard Disk.
d) an Optical Disk (such as a DVD).

a) a Central Processing Unit (CPU).

An example of an output device that interfaces between computers and humans is

a) a keyboard.
b) a mouse.
c) a speaker.
d) a microphone.

c) a speaker.

An example of an input device that interfaces between computers and humans is

a) a microphone
b) a monitor
c) a printer
d) a speaker

a) a microphone

Programs that are not running are usually stored

a) in the CPU's memory.
b) on the computer monitor.
c) in secondary storage.
d) on a backup device that is in a different physical location from the computer.

c) in secondary storage.

When a program begins to run,

a) It is moved from DVD to hard disk.
b) It is moved to the CPU's memory.
c) It is moved from the CPU's memory to hard disk.
d) It must be connected to a computer network.

b) It is moved to the CPU's memory.

Which one of the following typically provides data persistence without electricity?

I. The CPU's memory
II. The hard disk
III. Secondary storage

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

c) II, III only

Consider a scenario in which you develop a Java program on a computer that has a Pentium processor. What step should you take to run the same Java program on a computer that has a different processor?

a) The compiled Java machine language instructions can be run on any processor that has a Java Virtual Machine.
b) Develop the same program again on the computer that has a different processor and recompile the program.
c) Recompile the program on the computer that has a different processor.
d) You cannot run the program on a computer with a different processor because high-level programming languages are machine dependent.

a) The compiled Java machine language instructions can be run on any processor that has a Java Virtual Machine.

High-level programming languages

a) Are made up primarily of ones and zeros
b) Are independent of the underlying hardware
c) Are not standardized
d) Use syntax that is close to the underlying hardware's instruction set

b) Are independent of the underlying hardware

Which one of the following translates high-level descriptions into machine code?

a) Assembler
b) Linker
c) Compiler
d) Editor

c) Compiler

Computer scientists have devised something that allows programmers to describe tasks in words that are closer to the syntax of the problems being solved. This is called a(n)

a) Embedded system
b) Machine instruction
c) High-level programming language
d) Compiler

c) High-level programming language

Small applications written in the Java programming language that can be located anywhere on the Internet are called

a) Applets
b) Compilers
c) Embedded systems
d) Virtual machines

a) Applets

What is one of the benefits of using a high-level programming language like Java?

a) Its syntax is very similar to the hardware instruction set
b) No tools other than a text editor are required for programming
c) Statements in the high-level language are just like English
d) Problems solved in a high-level language are independent of the underlying computer hardware

d) Problems solved in a high-level language are independent of the underlying computer hardware

Because Java was designed for the Internet, which two of its attributes make it suitable for beginning programmers?

a) Efficiency and portability
b) Safety and security
c) Safety and portability
d) Efficiency and security

c) Safety and portability

An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?

a) An editor and a compiler
b) A web browser
c) Presentation tools
d) Source files and class files

a) An editor and a compiler

Which of the following are reasons why Java is good, but not perfect, for beginners?

I. A certain amount of technical machinery is necessary to write basic, simple programs
II. There are many extensions
III. There are a large number of extensive libraries in Java

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

d) I, II, III

What is the difference between an editor and a compiler?

a) An editor converts program files into an executable program; a compiler allows program files to be written and stored
b) An editor allows program files to be written and stored; a compiler produces an organized list of files
c) An editor allows program files to be written and stored; a compiler produces an indexed database of terms and keywords
d) An editor allows program files to be written and stored; a compiler converts program files into an executable program

d) An editor allows program files to be written and stored; a compiler converts program files into an executable program

Suppose you examine a simple Java program and the first line is public Class HelloPrinter. Is this the same thing in Java as the line public Class helloprinter?

a) No, because Java is case-sensitive, these are considered to be completely distinct
b) No, because "helloprinter" is misspelled, the Java compiler will reject it
c) Yes, because these Java symbols both have the same letters, they are considered to be the same
d) Yes, because all Java symbols must have exactly twelve characters.

a) No, because Java is case-sensitive, these are considered to be completely distinct

What statements about the integrated development environment (IDE) are true?

I. You may run Java class files even after exiting the IDE.
II. The IDE can invoke a virtual machine, which is required to run a Java program.
III. Translating Java source code into class files is enough to then actually run the program.

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

d) I, II, III

Consider the following statements about folders and your integrated development environment (IDE):

I. Hierarchical folders help to organize a project.
II. Folders are a way to visualize the layout of a file system.
III. Folders make it impossible to lose or accidentally delete a file.

a) Only I is correct
b) I, II, and III are correct
c) Only I and II are correct
d) Only III is correct

c) Only I and II are correct

Which of the following statements regarding backup strategies for Java files are true?

I. You should back up your projects often to prevent loss of valuable work.
II. You should check your backups only in case of loss of data.
III. You should pay attention to the backup direction.

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

b) I, III only

Every Java program consists of one or more

a) Values (arguments)
b) Classes
c) Strings
d) System.out.println statements

b) Classes

Characters that are grouped together between double quotes (quotation marks) in Java are called

a) reserved words
b) syntax
c) symbols
d) strings

d) strings

Every statement in Java must be terminated with

a) the semi-colon character ;.
b) a carriage return.
c) System.out.println().
d) an escape sequence.

a) the semi-colon character ;.

These two lines of code do not produce the same output. Why?

System.out.println(7 + 3);
System.out.println("7 + 3");

a) Arithmetic calculations cannot take place within the println method call.
b) In fact, the two statements do produce the same output.
c) The quotes cause the second expression to be treated as a string.
d) Because there are no escape characters.

c) The quotes cause the second expression to be treated as a string.

What is the output from this code snippet?

System.out.print("The sum is ");
System.out.println("7 + 3");

a) The sum is 10
b) The sum is 21
c) The sum is 4
d) The sum is 7 + 3

d) The sum is 7 + 3

Which of the following symbols is used to terminate a Java program statement?

a) Colon
b) Semicolon
c) Single quote
d) Period

b) Semicolon

Which of the following statements is valid with respect to the usage of a semicolon in Java?

a) A semicolon is used to denote the end of a statement.
b) A semicolon is used to terminate the public class statement.
c) You cannot use a semicolon to terminate the System.out.print statement.
d) You cannot put a semicolon within double quotation marks.

a) A semicolon is used to denote the end of a statement.

Which of the following statements is true with respect to the main method in Java?

a) The opening and closing parentheses after the method name main are optional.
b) A semicolon is required after the statement public static void main()
c) A semicolon is required after the closing curly braces in the main method.
d) Every Java application must have a main method.

d) Every Java application must have a main method.

A Java class with the name Printer has to be saved using the source file name:

a) printer.java
b) Printer.java
c) Printer.txt
d) printer.java

b) Printer.java

Which statement starts the declaration of a class in Java?

a) public static void main(String[] args)
b) public class Classname
c) System.out.println("Hello, World!");
d) Java class

b) public class Classname

Which Java statement prints a blank line?

a) public static void main(String[] args)
b) System.out.print();
c) System.out.println();
d) System.out.Println();

c) System.out.println();

Which Java statement does not contain an error?

a) System.out.print(;
b) System.out.print()
c) System.out.printl();
d) System.out.println();

d) System.out.println();

What is the output of the following code snippet?

System.out.print(4 + 4);
System.out.print(12);

a) 4 + 412
b) 4412
c) 812
d) 20

c) 812

What kind of error is it when your program has a syntax error?

a) Compile-time error
b) Logic error
c) Run-time error
d) Exception

a) Compile-time error

When a compiler finds a syntax error in a program, what happens?

a) The compiler goes ahead and produces a Java class file, but leaves out the statement where there was an error.
b) The compiler stops immediately.
c) The compiler requests input from the user before it will continue.
d) The compiler continues and may report about other errors but does not produce a Java class file.

d) The compiler continues and may report about other errors but does not produce a Java class file.

What kind of error is created by the following code snippet?

System.outt.println("Hello");

a) No error: the code is correct
b) Logic error: the program will run until it comes to this statement
c) Syntax error: the program will not compile
d) Exception: the statement will generate an exception

c) Syntax error: the program will not compile

What kind of error is created by the following code snippet?

System.out.print("The sum of 8 and 12 is ");
System.out.println(8 * 12);

a) No error: the code is correct
b) Logic error: the program does not produce the desired result
c) Syntax error: the code will not compile
d) Exception: the statement will generate an exception

b) Logic error: the program does not produce the desired result

What is a logic error?

a) An error that occurs when a program is running because, for example, the wrong operator was used.
b) An error in a statement that does not conform to the syntax of the programming language.
c) An error in the hardware from overheating.
d) An error introduced by the compiler when it guesses at how to fix a syntax error.

a) An error that occurs when a program is running because, for example, the wrong operator was used.

How do programmers find exceptions and run-time errors?

a) Using the compiler
b) Testing by running the program with a variety of input values
c) Carefully reading over the program code
d) Re-compiling using different symbols

b) Testing by running the program with a variety of input values

The programmer, not the compiler, is responsible for testing a program to identify

a) Syntax errors
b) Compile-time errors
c) Run-time errors
d) Undefined symbols

c) Run-time errors

47) Which one of the following errors represents a part of a program that is incorrect according to the rules of the programming language?

a) Syntax errors
b) Run-time errors
c) Logic errors
d) Out-of-memory errors

a) Syntax errors

Who or what is responsible for inspecting and testing the program to guard against logic errors?

a) Programmer
b) Integrated Development Environment
c) Compiler
d) End-user

a) Programmer

While developing a program, the programmer adds the discount amount to the total due instead of subtracting it. What type of an error is this?

a) A syntax error
b) A logic error
c) A hardware error
d) A compile-time error

b) A logic error

Which one of the following methodologies is a sequence of steps formulated in English for solving a problem?

a) Flowcharts
b) Pseudocode
c) Algorithms
d) Terminations

b) Pseudocode

In order to run Java programs on a computer, the computer needs to have software called a(n):

a) assembler
b) virtual machine
c) windows
d) debugger

b) virtual machine

In order to translate a Java program to a class file, the computer needs to have software called a(n):

a) assembler
b) virtual machine
c) compiler
d) debugger

c) compiler

The Java statement public static void main(String[] args) declares a:

a) class
b) variable
c) constant
d) method

d) method

A Java virtual machine is:

a) Software
b) Hardware
c) Firmware
d) Applet

a) Software

Which of the following statements must you include in a Java class that can be executed by the virtual machine?

a) System.out.println();
b) // Hello
c) public static void main(String[] args)
d) return 0;

c) public static void main(String[] args)

What is the output of the following code snippet?

System.out.print("Hello");
System.out.println("Good Day!");

a) Hello Good Day!
b) Hello
Good Day!
c) HelloGood Day!
d) HelloGoodDay!

c) HelloGood Day!

Which one of the following code snippets compiles without errors and displays the output "Hello Good Day!" on the screen?

a) System.out.print("Hello ");
System.out.println("Good Day!");
b) System.out.print("Hello );
System.out.println("Good Day!");
c) System.out.print("Hello ");
System.out.println("Good Day!")
d) System.out.print("Hello ");
System.out.println(Good Day!");

a) System.out.print("Hello ");
System.out.println("Good Day!");

What is the output of the following code snippet?

public class PrintIt
{
public static void main(String[] args)
{
System.out.println("4 * 4" + 12);
}
}

a) 4 * 412
b) 4412
c) 1612
d) 28

a) 4 * 412

Writing a computer game in Java that has graphics, motion, and sound effects

a) is simple because of the power of Java
b) requires a team of skilled programmers
c) cannot be done in the Java programming language
d) is more mundane than most programs

b) requires a team of skilled programmers

Which option correctly completes this statement? Programs can repeat simple instructions very quickly to

I. help human users to perceive images and sound
II. remove the drudgery of repeating instructions by hand
III. overcome the need for connectivity to the computer network

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

a) I, II only

The ENIAC computer burned out transistors at the rate of

a) ten per day
b) one hundred per day
c) several per day
d) None - it used vacuum tubes

d) None - it used vacuum tubes

In order for the ENIAC computer to be re-programmed

a) vacuum tubes needed to be replaced
b) wires needed to be plugged into a different wiring configuration
c) the programmer needed to load the program from cards
d) the programmer needed to download the new code over the computer network

b) wires needed to be plugged into a different wiring configuration

The language developed by Sun Microsystems that became the Java programming language was originally designed to be simple, secure, and

a) easy to use in any language
b) available over the Internet
c) usable for many different processor types
d) environmentally friendly, or "green"

c) usable for many different processor types

The term "applet" refers to

a) a Java program
b) a Java program that runs as a C++ program
c) a Java program that runs within an Integrated Development Environment (IDE)
d) a Java program that runs within a web browser

d) a Java program that runs within a web browser

Programmers have embraced Java over its closest rival, C++, mainly because

a) it is easier to use
b) it is easier to debug
c) it is cheaper to use
d) most computers only understand Java

a) it is easier to use

Java is said to be a "safe" programming language. What does this mean?

a) Java programs cannot cause environmental damage because they are "green".
b) Java programs can run within a browser without fear that they may attack your computer.
c) There is no way for a Java program to read or write a file.
d) Java programs cannot access data across a computer network.

b) Java programs can run within a browser without fear that they may attack your computer.

In order for Java to achieve portability

a) compiled Java programs contain instructions for a virtual machine
b) Java is not compiled
c) Java programs must be re-compiled on each platform where they are to run
d) Java programs are based on the C++ programming language

a) compiled Java programs contain instructions for a virtual machine

A Java Virtual Machine is

a) A theoretical machine to help understand the computational complexity of algorithms
b) A program that simulates a real CPU
c) A kind of computer hardware that is embedded into the CPUs of all computers using Java
d) A library package that extends the capability of the Java programming language

b) A program that simulates a real CPU

The Java programming language is itself relatively simple, but also contains a vast set of

a) syntactical variations
b) program templates
c) cross-platform scripting languages
d) library packages

d) library packages

The source code for a Java program is stored in a file

a) that ends with a .class suffix
b) that can have any valid file name
c) that ends with a .java suffix
d) that has no suffix

c) that ends with a .java suffix

A Java "class" file

a) contains Java source code
b) contains instructions to the Java virtual machine
c) is an internal file created by the Integrated Development Environment (IDE)
d) is the translation of the Java source code into C++

b) contains instructions to the Java virtual machine

Which pointers about backing up your Java projects are important?

I. Check your backups once in a while
II. Rely on the Java programming language's built-in back up system
III. Back up often

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

b) I, III only

Which statements are true?

I. In Java, a file can contain at most one public class
II. The word public denotes that the class is usable by the "public"
III. Every Java program must have a main method

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

d) I, II, III

The technical term for the values that a method needs in order to carry out its task is an argument. When there is more than one argument needed by a method, they are

a) separated by semicolons
b) separated by spaces
c) separated by commas
d) merged into a single variable

c) separated by commas

In Java, if you want the compiler to interpret what you type as program instructions, you must

a) enclose those instructions within quotation marks
b) start the line that you type with the symbols //
c) write the instructions in all capital letters
d) write correct Java statements separated by the semicolon

d) write correct Java statements separated by the semicolon

In Java, the statement

System.out.print("hello");;;

a) is a syntax error
b) is a legal statement
c) seems like it should print out "hello" but doesn't
d) asks the user to enter a value and stores it in the variable "hello"

b) is a legal statement

Sometimes errors throw the compiler off track because

a) the compiler does not give up when it finds the first error
b) the compiler must be trained by your programming style
c) the compiler does not understand quotation marks
d) it cannot tell which language you are writing without a network connection

a) the compiler does not give up when it finds the first error

Some run-time errors are so severe that they generate

a) an exception
b) an email to your account
c) the loss of your source code file
d) a syntax error

a) an exception

During program development, errors are

a) very rare
b) prevented by the compiler
c) automatically tracked by the Integrated Development Environment (IDE)
d) unavoidable

d) unavoidable

If you misspell a word in your Java program it may be true that

I. the program will not compile
II. the program may compile, but not run
III. the program may compile and run but still have a logic error

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

d) I, II, III

Which of these are true about writing algorithms in pseudocode?

I. The exact wording is not important
II. The sequence of steps should be ambiguous
III. The algorithm should terminate

a) I, II only
b) I, III only
c) II, III only
d) I, II, III

b) I, III only

A sequence of steps that is unambiguous, executable, and terminating is called

a) pseudocode
b) an algorithm
c) a logarithm
d) a programming task

b) an algorithm

The first step in describing an algorithm in pseudocode is

a) break the algorithm into smaller pieces
b) test the algorithm by working a problem
c) write the steps out in Java code
d) determine the inputs and the outputs

d) determine the inputs and the outputs

What tool translates Java source code into files that contain instructions for the Java Virtual Machine?

The Java compiler (javac) converts the source code into bytecode. Bytecode is a kind of average machine language. This bytecode file (. class file) can be run on any operating system by using the Java interpreter (java) for that platform.

What tool translates Java source code into files?

DESCRIPTION. The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files. It can also process annotations in Java source files and classes.

What does a Java compiler do quizlet?

Java uses a compiler to translate that program source code(. java file created by the programmer) into bytecode (. code file). Java then continues and uses an interpreter to translate the bytecode into machine code line by line during execution.

How does Java code translate to machine code?

Rather than make you go write machine code, we use a program called a compiler. A compiler translated code written in one language to that written in another language. Thus, a compiler converts Java programs to machine code, which can then be run on the computer.