C Programming Multiple choice
In a program that uses an endfile-controlled loop to compute product of a list of numeric input data, the product variable must be initialized to
1
The constant 0.15e+6 represents the same value as
1500000
The value of the expression 5 + 6.6 / 2.2 * 0.5 is
6.5
Which one of the following expressions does not evaluate to 3?
7-15/4
Write a complete C program that prompts the user to enter the radius of a circle and displays the circumference. Be sure to name the constant PI.
Answer: #include <stdio.h> #define PI 3.14159 int main(void) { double radius, circum; printf("Please enter radius of circle> "); scanf("%lf", &radius); circum = 2 * PI * radius; printf("The circumference is %.2f.\n", circum); return (0); }
The proper sequence of steps needed to correct invalid statements and re-execute a program is
Enter the editor, correct invalid statements, save the program, compile, link, load, and execute the program.
An application that provides the user with pictures and menus from which to select commands and data is said to have a(n)
GUI
Which of the following is not an advantage of a high-level language?
It is easy for the machine to understand
The program's effect can best be described as __________.
Of the four input characters, it displays the one that comes first in the alphabet.
Temporary storage for programs and data is called ___.
RAM
_____ stores instructions burned at the factory and is non-volatile.
ROM
words have special meaning in C and cannot be used to name variables
Reserved
What happens to the fractional part of a type double expression when the expression is assigned to a type int variable?
The fractional part is lost.]
In C, true evaluates to and false evaluates to
True = 1 False = 0
The Internet is an example of a
WAN
Order the following operators from lowest to highest precedence.
[ = && != > + % ! ]
##403#####201.45####-11.200
[One answer: printf("%5d%11.2f%11.3f\n", a, b, c);]
When the value of a variable is changed as the result of carrying out some operation on it, it is called .
a side effect
What type of function does not contain a return statement?
a void function
A complete list of the steps necessary to solve a problem is a(n)
algorithm
The component of a digital computer that can compare data stored in its registers is the
arithmetic logic unit
Which of the following are valid identifiers? i. R3D3 ii. per-capita iii. phone# iv. ice_cream v. 92_aardvarks
b. i,iv (R3D3, ice_cream)
A(n) ____ is the amount of memory required to store a single binary digit.
bit
In a debugger, use a(n) ______ at the end of each major algorithmic step so that you can examine variables to see if your program is executing correctly.
breakpoint
A __ is the amount of memory required to store a single character.
byte
Information stored in secondary storage is organized into aggregates called
bytes
The part of the computer responsible for retrieving data and instructions from memory for processing is the
central processing unit
A function that performs a single operation is said to be
cohesive
The object file is created by the
compiler
A _________ is a set of values and a set of operations on those values.
data types
Performing each step of an algorithm by hand the same as a computer would to verify the algorithm is correct is called a(n)
desk check
A _____ is a diagram that shows how a control structure will execute step by step.
flowchart
A loop that never terminates is a(n) ______ loop.
infinite
The (what) of a function take(s) information into the function from the calling program.
input arguement
Text enclosed in /* */ in a C program _________.
is ignored by the C compiler
Variables defined inside a function body are considered _____.
local
An expression that uses the &&, ||, and ! operators is call a(n)
logical expression
Which of the following is not a floating-point data type in C?
long
The compiler translates your program into _____ language.
machine
An expression that has operands both of type int and of type double is called a
mixed type
In an interactive program, the statement printf("\n"); has the effect of
moving the cursor to the beginning of the next line
What is the program output if the user types runt followed by a carriage return when the program is run?
n
. When a sentinel-controlled loop performs an extra iteration it is called a(n)
off-by-one error
Which of the following statements calls function abc?
p = abc(q);
Which of the following variables names is considered Camelback notation?
payRate
An individual picture element on the screen is a(n)
pixel
The following statement is call a(n) _______. i++;
postfix increment
The facts that a function assumes to be true of the arguments that it receives are called
preconditions
An integrated circuit containing the full circuitry of a CPU is called a
processor chip
Variables that represent neither problem inputs nor problem outputs but are needed for internal computations are called _____.
program variables
A function _____ tells the compiler the data type of the function, name of the function, and information about the arguments the function expects.
prototype
Code ____ promotes the development of error-free programs because the programmer does not need to repeatedly solve the same problems.
reuse
A ______ error may be detected during execution of a program.
runtime
Loops that terminate upon scanning a special input value are called ________-controlled loops.
sentinel
A special value that marks the end of a list of input data is called a
sentinel value
When C stops evaluating a logical expression because the value can be determined without the rest of the expression, it called a(n) __________ evaluation.
short-circuit
A C compiler detects ______.
syntax errors
A C programmer should not use an expression like the one that follows because ______. n = i + x * ++i;
the expression may produce different results on different ANSI C compilers
What is displayed by the C statements that follow if the value input is 9?
true
Code that is attached to another program that spreads through the computer's memory creating harm is called a(n) _____.
virus
Which one of these is not the name of a C library function?
void
A(n) ____ disrupts a computer network by replicating itself on other network computers
worm
The relational operator for "not equal to" is
!=
What symbol is used for a preprocessor directive
#
The preprocessor directive is used to define constant macros.
#define
Which one of the following lines names a constant needed in a program that computes the price per square inch of a round pizza?
#define PI 3.14159
Which directive gives your program access to a library?
#include
Write a preprocessor directive to tell the preprocessor where to look for common standard input and output functions.
#include <stdio.h>
If num is a variable of type int and temp is a variable of type double, how could you correctly complete this function call? scanf("%lf%d", _________);
&temp, &num