Java midterm (ch. 1)
What is the output of the following Java statement? "System.out.println("4 + 6");
"4 + 6"
Assume that the "main" method of the class named "welcome" does not contain any compile-time errors. What is the name of the file generated by the Java compiler?
"Welcome.class"
Arguments supplied to methods are enclosed by which symbols?
()
When was Java officially introduced?
1995
No matter which Java development environment you use, what happens to the Java source code in order for Java program to execute?
A Java compiler translates the source code into class files.
Which statement best describes a computer program?
A program is a sequence of instructions and decisions that the computer carries out.
The line "public class HelloPrinter" indicates which declaration below?
Declaration of the class "HelloPrinter"
what is the name of the file that contains the Java source code for public class "HelloPrinter"?
HelloPrinter.java
Suppose that a computer virus infects your computer and corrupts the files you were going to submit for your current homework assignment. What precaution could have saved you from a disastrously bad grade for this assignment?
Make regular backups of all your important files.
Assume that the following Java statement is contained in the "main" method of the class named "Hello". System.out.printLine("Hello!"); What is the name of the file generated by the Java compiler?
No file is generated due to an error.
Which one of the following is NOT a function of a CPU?
Querying a database
What is the syntax for calling the "println" method on the object "System.out"?
System.out.println("Any message");
Which statement best describes the portability characteristic of Java?
The same already-compiled Java programs will run on Windows, UNIX, Linux, or Macintosh operating systems without any change.
Assuming the programmer wishes to output the phrase "Welcome!", which of the following is true about the following Java statement. System.out.Println("Wlcome!");
There are multiple errors
Assuming the programmer wishes to output the phrase "Welcome!", which of the following is true about the following Java statement. System.out.println("Welcme!");
There is a run-time error
Which statement is true about running a Java program on a different CPU?
You can take code that has been generated by the Java compiler and run it on different CPUs.
Which statement regarding backup strategies for Java files is correct?
You should have multiple copies of your source files in different locations.
What is the Java Virtual Machine?
a program that simulates a real CPU running compiled Java code.
What term is used to refer to a sequence of steps for solving a problem that is unambiguous, executable, and terminating?
algorithm.
What is the term used to refer to Java code that runs in a browser?
applet
What term is used to refer to values supplied to a method that are needed to carry out its task?
argument
If you get a sequence of error messages from the compiler that are increasingly off track, you should
check for spelling, capitalization, or missing quotation marks.
Every Java program consists of one or more of these fundamental building blocks
class
what is the term used to describe an error detected by the complier that is a violation of the programming language rules?
compile-time error
What tool translates Java source code into files that contain instructions for the Java Virtual Machine?
compiler
Which statement regarding computer programs is correct?
computer programs are composed of extremely primitive operations.
A sequence of steps that can be carried out in practice is
executable
Which type of secondary storage consists of rotating platters coated with a magnetic material?
hard disk
What term is used to refer to languages that allow programmers to describe tasks at a higher conceptual level than machine code?
high-level
Other than run-time error, what is another term used to describe an error causing a program to take an action that the programmer did not intend?
logic error
where must program instructions and data reside in order for the CPU to directly read and execute them?
memory
A __________ contains sequences of programming instructions that describe how to perform a particular task.
method
Whenever a method is called in Java, what must be specified?
method name, arguments
Which memory types does not provide persistent storage?
primary storage
Which type of storage is made from electronic circuits that can store data?
primary storage
What is the name of the method in the given method call? System.out.println("Welcome");
println
Who or what is responsible for inspecting and testing the program to guard against logic error?
programmer
What term is used to refer to an informal description of a sequence of steps for solving a problem?
pseudocode
what is the term used to describe an error causing a program to take an action that the programmer did not intend?
run-time error
which one of the following memory types provides storage that is slower and less expensive?
secondary storage
which is an example of a peripheral device?
speakers
The error message "cannot find symbol" is usually a good clue that what kind of error has been made?
spelling
What term is sued to refer to an individual instruction inside a method?
statement
What term is used to refer to an individual instruction inside a method?
statement
What term is used to refer to a sequence of characters enclosed in quotation marks?
string
other than compile-time error, what is another term used to describe an error detected by the compiler that is a violation of the programming language rules?
syntax error
A sequence of steps that eventually comes to an end is
terminating
which statement is true about the compilation process?
the compiler will continue compiling after it finds an error.
A sequence of steps is unambiguous when
there are precise instructions for what to do at each step and where to go next.
Which statement is true about the following Java code fragment: System.out.println("Hello!);
there is a compile-time error.
A sequence of steps that contains precise instructions for what to do at each step and where to go next is
unambiguous
Which of the following options is true about algorithms?
you must create an algorithm for a problem before you can create a program to solve the problem.