CS 159 Exam #1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A variable declared in the local declaration section of a function can have the same identifier as one of the parameters of the same function

False

Each rectangle on a structure chart represents the user-defined and standard library functions used in a program

False

It is a good design practice to replicate the logic of one function in other functions of the program

False

It is never possible to determine if any parameters are passed to a function by address from an example call to the function

False

It is permissible to declare multiple variables on the same line

False

Place a tab between all operators and operands

False

The C programming language is not considered a high-level programming language because of its age.

False

The abs function is found in math.h

False

The complement of x >= 3 is x <= 3

False

The control of the program always returns from the called function to the main function

False

The first line of the function definition terminates with a semicolon (;)

False

The function declaration is an executable statement

False

The gcc compiler as found on guru will require that the main function be void

False

The possible result of the following expression for any non-negative integer x is 0 or 1: (x + 1) % x

False

The short-circuit method of evaluating logical expressions is only relevant to those expressions that make use of at least one relational operator

False

The software used to write and edit programs is known as a compiler

False

The use of a precision modifier when displaying a floating-point value will result in truncating all digits beyond the specified precision value

False

When working with a parameter that has been passed by address it is unnecessary to use the & (address) operator in the scanf because a pointer variable already represents a memory location

True

The scope of an object determines the region of the program in which it is visible (and defined).

True

The void in the following declaration statement would be optional : int getData(void);

True

The width modifier for the output of a value must be large enough to account for the integral value of the number, the decimal point, and the number of digits in the decimal position

True

There is no semi-colon following the logical expression of an if ... else construct

True

The logical OR operator is true only when at least on of its operands is true

True

The operand in a postfix or prefix expression must be a variable

True

The result of the following expression for any positive (greater than zero) integer is 0: 1 - (x + 2) % (x + 1)

True

A precision modifier may be used for the output of any numeric value

False

Which of the following print statements would produce the given output? -=-=-=-=-=-=- x: 314159 -=-=-=-=-=-=- printf("-=-=-=-=-=-=-"); printf("x:%10d\n", x); option A printf("x: %10d\n, x); option B printf("x:%-10d\n", x); option C printf("x: %-10d\n", x); option D printf("-=-=-=-=-=-=-); NONE OF THE ABOVE - option E

B

Which of the following is incorrect regarding the rules for the selection of an identifier? A. The first character cannot be a digit B. An identifier cannot duplicate a reserved word. C. Only the first 31 characters are significant D. An identifier cannot use a dot character E. None of the above

C

Which of the following from the guru server is incorrectly described? A. gcc compiler B. vi text editor C. a.out source code file D. cd returns to the home directory E. None of the Above

C`

Which of the following statements regarding printf and scanf is TRUE? A. A printf function will always make use of its data list. B. A scanf function is composed of a format string and a data list C. All data types will make use of size character(s) as part of the placeholder D. The scanf function would not typically make use of the '\n' character within its format string E. None of the above

D

Which of the following commands in vi is incorrectly described? A. :w saves the current file but does not exit the editor B. o moves into insert mode by opening a new line below the current one C. dd deletes the current line D. hlb inserts the lab assignment header into the current file E. none of the above

E

Which of the following statements regarding the structure of a C program is FALSE? A. All code found between the { and } is referred to as the body of the main function B. The #include<stdio.h> statements is a preprocessor directive C. The two sections of the main function are the local declarations and executable statements D. The return(0); statement terminates the main function E. None of the above

E

A function assignment header for every user-defined function must be inserted immediately above the declaration of the function it is documenting.

False

A function that accomplishes multiple processes is functionally cohesive

False

A local variable can be referenced through its identifier outside of the function in which it is defined

False

When attempting to print the result of a logical expression that is true as an integer the result will may be any non-zero value

False

Within each function the local declarations and executable statements may be permitted to overlap

False

(a !- 0) and !(a == 0) are equivalent logical expressions (the variable a is an integer)

True

(a != 0) and !(a) are complementary logical expressions (the variable a is an integer)

True

A C program begins with a section for preprocessor directives

True

A flowchart uses geometric symbols to represent the logic of a function or module in the larger program.

True

A function may return at most one value.

True

A literal constant is an unnamed constant used to specify data

True

A single-type operation will generate a result of that same type.

True

All code found between { and } of the main function is considered to be to body of the function

True

All the compound assignment operators share the same level of precedence.

True

Careful design of software can result in programs that will be efficient, error-free, and easy to maintain.

True

Complementing a condition is one way to potentially remove negative logic from an expression

True

Each variable in a C program must be declared and defined before it can be used.

True

Evaluate the following expression: 0 || 3 && 6

True

Given the address of a variable the called function can access and manipulate the value of a variable in the calling function

True

In an assignment statement, promotion occurs if the right expression has a lower rank than the variable on the left and demotion occurs if the right expression has a higher rank

True

In downward communication it is only a copy of the data that is sent to the function

True

It is a course standard to indent all code within the body of relevant selection constructs two additional spaces

True

Not every function that utilizes pass by address are necessarily void functions

True

One purpose of preprocessor directives is to instruct the preprocessor to make substitutions in the code

True

One purpose of preprocessor directives is to instruct the preprocessor to make substitutions in the code.

True

Problems associated with defined constants are difficult to resolve as a programmer views the original statement and not the statement with the error after the substitution takes place

True

Symbolic languages use mnemonics to represent the various machine language instructions

True

The CPU is responsible for executing instructions for the computer

True

The asterisk has two different uses, declaring an address variables (pointer) and indirectly accessing the data (in the memory location to which the variable points)

True

The backslash (\) is known as an escape character

True

The command to create a defined constant is usually placed at the beginning of the program

True

The compound assignment operator (*=) has a lower level of precedence then the subtraction operator (-)

True


Ensembles d'études connexes

2. The Head and Crown of Creation

View Set

Mental Health - Chapter 11 Childhood and Neurodevelopmental Disorders

View Set

Personal Financial Planning - Exam 1 - Wiley

View Set

The Movement I: Renaissance Architecture

View Set

Nama surat Al-Qur'an dan arti [31-40]

View Set

The Big Bang Theory, Formation of the Solar System, Structure of the Sun, Discerning Earth's History, and Geologic Time Midterm study guide

View Set

Chapter 17: Business Organizations

View Set

Biology 1108 Test 3 - Definitions

View Set