Programming Flashcards
The programmer, not the compiler, is responsible for testing a program to identify _________________.
run-time errors
An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?
an editor and a compiler
How do programmers find exceptions and run-time errors?
Testing by running the program with a variety of input values
High-level programming languages ________________________
are independent of the underlying hardware
When a program begins to run, ___________________________.
it is moved to the CPU’s memory
Which of the following typically provides data persistence without electricity?
I. The CPU’s memory
II. The hard disk
III. Secondary storage
II and III only
An example of an output device that interfaces between computers and humans is ____________.
a speaker
Which one of the following translates high-level descriptions into machine code?
compiler
What is the difference between an editor and a compiler?
An editor allows program files to be written and stored; a compiler converts program files into an executable program.
Programs that are not running are usually stored _____________________.
in secondary storage
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.
I, III, and IV only
A sequence of steps that is unambiguous, executable, and terminating is called _______________.
an algorithm
Who or what is responsible for inspecting and testing the program to guard against logic errors?
programmer
Computer programming is ______________________.
the act of designing and implementing a computer program
Computers are machines that __________________.
execute programs
An example of an input device that interfaces between computers and humans is ____________.
a microphone
Computer scientists have devised __________________ that allow programmers to describe tasks in words that are closer to the syntax of the problems being solved.
high-level programming languages
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?
logic error
The Central Processing Unit is primarily responsible for ______________.
performing program control and data processing
Which of the following guidelines will make code more explanatory for others?
Add comments to source code.
Assuming that the user inputs a value of 30 for the price and 10 for the discount rate in the following code snippet, what is the output?
Scanner in = new Scanner(System.in);
System.out.print(“Enter the price: “);
double price = in.nextDouble();
System.out.print(“Enter the discount rate: “);
double discount = in.nextDouble();
System.out.print(“The new price is “);
System.out.println(price - price * (discount / 100.0));
The new price is 27.0
Assuming that the user inputs “Joe” at the prompt, what is the output of the following code snippet?
public static void main(String[] args)
{
System.out.print(“Enter your name “);
String name;
Scanner in = new Scanner(System.in);
name = in.next();
name += “, Good morning”;
System.out.print(name);
}
Joe, Good morning
Which one of the following code snippets compiles without errors and displays the output “Hello Good Day!” on the screen?
System.out.print(“Hello “);
System.out.println(“Good Day!”);
Assuming that the user inputs a value of 25000 for the pay and 10 for the bonus rate in the following code snippet, what is the output?
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print(“Enter the pay: “);
double pay = in.nextDouble();
System.out.print(“Enter the bonus rate: “);
double bonus = in.nextDouble();
System.out.println(“The new pay is “ +
(pay + pay * (bonus / 100.0)));
}
The new pay is 27500