Untitled Flashcards Set

 

What is the correct statement to determine if x is between 19 and 99?

Answer: x > 19 && x < 99

 

The braces for a loop define the _______ of the loop.

Answer: Function

 

In a compound logical and (&&) expression, the evaluation of the expression stops once one of the terms of the expression is false. This is know as _______ evaluation.

Answer: Short-Circuit

 

_____ is the decimal number associated with the ASCII character ‘0’.

Answer: 48

 

A loop that always executes the loop body at least once is known as a _____ loop.

Answer: While

 

The format specifier used to tell printf to expect a double precision floating number is a percent sign followed by the character(s) _____.

Answer: f

 

Each time a loop body executes is known as _____.

Answer: iteration

 

if-else statements that are inside other if-else statements are said to be _____.

Answer: nested

 

When must we use braces to define the body of a conditional expression?

Answer: When there is more than one statement

 

int myValue; is called a _____.

Answer: declaration

 

The format specifier used to tell printf to expect an interger is a percent sign followed by the character(s) _____.

Answer: %d

 

The portion of the printf function call within the double quotes is called the _____.

Answer: format string

 

_____ is the decimal number -42 converted to an 8 bit binary number using 2’s complement notation.

Answer: 11010110

 

What is the opposite of ( x < 20 && x > 12)?

Answer: (x >= 20 || x <= 12)

 

Is printf used for input or output?

Answer: output

 

Write the loop condition to continue a while loop as long as x is negative.

Answer: while(x < 0)

 

_____ is the decimal number 42 converted to an 8 bit binary number using 2’s compliment notation.

Answer: 00101010

 

Packet 2:

A switch statement variable must be an _____.

Answer: interger

 

______ is a type whose values are defined by a list of constants of type int.

Answer: enum

 

A loop that iterates one too many or one too few times is said to be _____.

Answer: off-by-1

 

A _____ loop always executes the loop body at least once, regardless of the loop condition.

Answer: do-while

 

The code following the _____ case is executed if none of the other cases are matched in a switch statement.

Answer: default

 

Variables defined inside a set of braces are said to be _____ to that block of code.

Answer: local

 

A _____ expression is an expression that can be thought of as being true or false

Answer: Boolean

 

The format specifier used to tell scanf to expect a double precision floating point number is a percent sign followed by the character(s) _____.

Answer: lf

 

Each repetition of a loop body is called _____.

Answer: iteration

 

A compound statement that contains variable declarations is called a _____.

Answer: Block

 

The compiler always pairs an else with _____.

Answer: Closet unmatched if statement

 

Packet 3:

Converting from one type to another is called _____.

Answer: type cast

 

Write the code to convert the value in an interger variable named count to a temporary double

Answer: (double) count

 

Algorithms are typically described in_____.

Answer: Pseudocode

 

When you want to execute a function in your program, you would make a function _____.

Answer: call

 

The _____ of a variable is where that variable can be used.

Answer: scope

 

In the following function declaration, the variable size is known as a _____.

              int myFunction ( int size );

Answer: formal parameter

 

Constant variables that might be used in different functions should be _____.

Answer: global

 

The absolute value of function abs is located in the _____ library.

Answer: stdlib.h

 

Variables that are declared inside a function are said to be _____ to that function.

Answer: local

 

#include <math.h> is known as an _____.

Answer: Include Directive

 

A problem-solving approach that starts with the big problem and breaks it down into smaller pieces is called ______.

Answer: Top-down design

 

The _____ describes how the function will work.

Answer: function body

 

The black box analogy demonstrates the concept of _____.

Answer: procedural abstraction

 

What is the output produced by the following code fragment?

              int i = 3;

              printf(“%.2f\n”, sqrt( pow(i,4.0) ) );

Answer: 9.00

 

What is the value of (pow(2,sqrt(9.0) + ceil(0.99)))?

Answer: 16

 

Packet 4:

When the address of the actual argument is passed to the formal parameter, this allows us to mimic a parameter passing mechanism called _____.

Answer: Pass-by-reference

 

Using functions in a program is called _____.

Answer: Procedural abstraction

 

What is the correct way to call the following function?

              Void setDisplay( void );

Answer: setDisplay();

 

The items passed to a function are called _____.

Answer: arguments

 

The & operator is called the _____ operator.

Answer: address

 

A _____ is a main program that only checks that functions execute correctly.

Answer: driver

 

If we want to test if a given function works correctly, we would write a _____ to test it.

Answer: test case

 

A _____ is a simplified version of a function used to test the main program.

Answer: stub

 

What type of value does a void function return?

Answer: no value

 

Testing a program with values that are close to values that will change the execution of a program is called _____.

Answer: boundary testing

 

The values or variables listed in the function declaration are called _____ to the function.

Answer: parameters

 

What symbol is used to signify that a parameter is a pointer?

Answer: *

 

What is the most appropriate way to call the doThings function? Assume that you have two variables named var1 and var2 defined as follows.

int var1;

float var2;

 

Answer: doThings(var2,var1)

 

Pre and post conditions for a function should be written (before/after) the function definition is written.

Answer: before

 

Given the following function definition fragment, for which values of myInt should the function be tested?

int doSomething(int myInt)

{

              If(myInt < 0)

              {

                             //do some stuff here

              {

              return -1;

}

Answer: -1, 0, 1

 

A function that does not return a value is known as a _____ function.

Answer: void

 

 

 

 

Packet 5:

 

The function used to open a file and return a FILE pointer for that file is _____.

Answer: fopen()

 

When a file fails to open, fopen returns or evaluates as _____.

Answer: NULL

 

The format specifier to display floating point numbers in scientific notation is the percent sign followed by the letter: _____.

Answer: e

 

The format specifier that always shows the decimal point to display floating point numbers is the percent sign followed by the letter:

Answer: f

 

“\n” is a _____ and ‘\n’ is a _____.

Answer: c-string, character

 

Write the format specifier used to change the number of decimal places displayed in a floating point number to 3 decimal places.

Answer: %.3f

 

Which functions read one character even if that character is a blank space?

Answer: fgetc, getc, getchar

 

The format specifier to display floating point numbers in the shortest notation is the percent sign followed by the letter: _____.

Answer: g

 

When you are finished using a file you should close the file using the function _____.

Answer: fclose()

 

_____ is the safe function used to get a restricted length c-string from a file or the keyboard.

Answer: fgets

 

The special character used to mark the end of a C-string is called the _____ character.

Answer: NULL terminator

 

All data is input and output as _____ data.

Answer: character

 

scanf, fscanf, and sscanf return _____.

Answer: number of successful scans