CSA Test 1
Which type of secondary storage consists of rotating platters coated with a magnetic material?
Hard disk
Which statement is true about running a Java program on a different CPU? a) You can take code that has been generated by the Java compiler and run it on different CPUs. b) You need to compile the Java program for each CPU. c) You need different Java source code for each CPU. d) You cannot run the program on a different CPU because Java, being a high-level programming language, is machine dependent.
a) 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? a) You should have multiple copies of your source files in different locations. b) Your compiler automatically makes backups of your source files. c) You should regularly print out your work so you can retype it in case of data loss. d) You should regularly back up the Java virtual machine instructions to prevent loss of valuable work.
a) You should have multiple copies of your source files in different locations.
Which is an example of a peripheral device? a) the CPU b) speakers c) primary storage d) motherboard
b) speakers
Every Java program consists of one or more of these fundamental building blocks.
class
What is the argument in the given method call? System.out.println("Welcome");
"Welcome"
Arguments supplied to methods are enclosed by which symbols?
( )
What is the output of the following Java statement? System.out.println(4 + 6);
10
When was Java officially introduced?
1995
What is the output of the following Java statement? System.out.println("4 + 6");
4+6
In Java, every statement must end with which symbol?
;
What does CPU stand for?
Central Processing Unit
Some computers are self-contained units; others are interconnected through what?
Networks
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 type of storage is made from electronic circuits that can store data?
Primary storage
What is a logic error? a) A program that is syntactically correct but does not do what it is supposed to do. b) An error that is so severe that it generates an exception. c) A missing main method. d) A violation of the rules of the computer language.
a) A program that is syntactically correct but does not do what it is supposed to do.
What is the Java Virtual Machine? a) A program that simulates a real CPU running compiled Java code. b) A CPU that runs compiled Java code. c) A program that translates Java code into machine instructions. d) A library that makes it possible to write portable programs.
a) A program that simulates a real CPU running compiled Java code.
Which statement regarding computer programs is correct? a) Computer programs are composed of extremely primitive operations b) Small computer programs are not documented c) Computer programs can decide what task to perform d) Large and complex computer programs are generally written by only one programmer
a) Computer programs are composed of extremely primitive operations
Assuming the programmer wishes to display "Hello!" on the screen, which statement is true about the following Java code fragment: System.out.printn("Helo!"); a) There are multiple errors. b) There are no errors. c) There is a run-time error. d) There is a compile-time error.
a) There are multiple errors.
Which statement is true about the following Java code fragment: System.out.println("Hello!); a) There is a compile-time error. b) There is a run-time error. c) There are multiple errors. d) There are no errors.
a) There is a compile-time error.
Assuming the programmer wishes to display "Hello!" on the screen, which statement is true about the following Java code fragment: System.out.println("Helo!"); a) There is a run-time error. b) There are no errors. c) There are multiple errors. d) There is a compile-time error.
a) There is a run-time error.
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
No matter which Java development environment you use, what happens to the Java source code in order for a Java program to execute? a) The source code is automatically separated into many files. b) A Java compiler translates the source code into class files. c) A Java compiler converts all uppercase letters to lowercase. d) The source code is backed up to a network storage facility.
b) A Java compiler translates the source code into class files.
What is an example of a typical instruction in a computer program? a) Display a fancy font b) Add up two numbers c) Drive a car d) Lay out a term paper
b) Add up two numbers
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? a) Purchase an extended warranty for your computer b) Make regular backups of all your important files c) Defragment the hard drive d) Purchase an anti-virus program to remove the virus from your computer
b) Make regular backups of all your important files
Which statement best describes the portability characteristic of Java? a) It is easy to change a Java program so that it will work on different operating systems. b) The same already-compiled Java programs will run on Windows, UNIX, Linux, or Macintosh operating systems without any change. c) There are only small differences between the Java programming language on different operating systems. d) The same Java compiler can be used on many operating systems.
b) The same already-compiled Java programs will run on Windows, UNIX, Linux, or Macintosh operating systems without any change.
Which statement best describes a computer program? a) A program is a sequence of commands b) A program can decide what task it is to perform c) A program is a sequence of instructions and decisions that the computer carries out d) A program can only perform one simple task
c) A program is a sequence of instructions and decisions that the computer carries out
Which one of the following is NOT a function of a CPU? a) Fetching and storing data from storage and input devices b) Performing arithmetic operations c) Querying a database d) Processing data and controlling processes
c) Querying a database
Assuming the programmer wishes to display "Hello!" on the screen, which statement is true about the following Java code fragment: System.out.println("Hello!"); a) There are multiple errors. b) There is a run-time error. c) There are no errors. d) There is a compile-time error.
c) There are no errors.
What is the term used to describe an error detected by the compiler 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
What tool translates high-level instructions into low level machine code?
compiler
The line /public class HelloPrinter\ indicates which declaration below? a) Declaration of the variable /public\. b) Declaration of the variable /class\. c) Declaration of the class /public\. d) Declaration of the class /HelloPrinter\.
d) Declaration of the class /HelloPrinter\.
What is the name of the file that contains the Java source code for the public class /HelloPrinter\? a) HelloPrinter.txt b) HelloPrinter.class c) HelloPrinter d) HelloPrinter.java
d) HelloPrinter.java
Which one of the following memory types provides storage that persists without electricity? a) memory b) RAM c) primary storage d) secondary storage
d) Secondary storage
What is the syntax for calling the println method on the object System.out? a) System.out("Any message").println; b) println("Any message").System.out; c) println(System.out,"Any message"); d) System.out.println("Any message");
d) System.out.println("Any message");
Why should you set aside time to become familiar with the programming environment? a) The time you spend will prevent data loss without the need for backups. b) Although computer systems vary widely, the Java programming environment is always the same. c) The Java libraries are detailed and extensive. d) The tools needed for Java programming are different from other software.
d) The tools needed for Java programming are different from other software.
Which one of the following memory types provides storage that is slower and less expensive a) peripheral device b) the translator c) primary storage d) secondary storage
d) secondary storage
What term is used to refer to languages that allow programmers to describe tasks at a higher conceptual level than machine code?
high-level
What term is used to refer to the computer instructions that are executed by a CPU?
machine code
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 type does not provide persistent storage?
primary storage
What is the name of the method in the given method call? System.out.println("Welcome");
println
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
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