|
|
CS 215: UNIX C Programming
Review for Quiz 3
- 1. Direct input, or the immediate echoing of input characters,
is an instance of _____ input.
- buffered
- unbuffered
- bufferless
- buffed
- All of the following are advantages of buffered
input except which one of the following?
- Less time consuming to transmit characters.
- Allows for keyboard corrections before transmission.
- Especially suited for games like Doom
- Allows only the corrected version to be displayed.
- A ___ is an area of memory in which information is stored.
- fence
- fact
- farm
- file
- In C, keyboard input is represented by a stream called ___
and output is represented by a stream called ___.
- in, out
- str_in, str_out
- stin, stout
- stdin, stdout
- In UNIX or DOS, which one of the following is a redirection
operator?
- ?
- :
- <
- =
- Which one of the following allows you to run a
copy program, named echo_eof.exe, to make a copy
of the file, myword, and to save the copy as a file
named, saveword?
- echo_eof.exe > myword < saveword
- echo_eof.exe < myword < saveword
- echo_eof.exe < myword > saveword
- echo_eof.exe > myword > saveword
- Writing C statements that require the computer to determine
if user input falls within an acceptable range is
called ______.
- error-checking
- keyboard control
- irritating programming
- range building
- Which DOS character entered at the keyboard is used
to simulate the end-of-file condition in UNIX?
- control-D
- control-P
- control-C
- control-Z
- Interspersing calls to getchar() and scanf() can cause
problems when scanf() leaves ___ in the input, just
before a call to getchar().
- \t
- \n
- \0
- \Z
- Which UNIX (and DOS) character is used to add
data to the end of an existing file?
- !!
- >>
- ||
- //
- A function is a self-contained unit of program
code design to _____.
- replace main()
- trap all input errors
- accomplish a particular task
- avoid I/O files
- Functions do all of the following EXCEPT
- Make a program easier to read.
- Make a program more modular.
- Make a program easier to repair.
- Make a program bug free.
- Which of the following best explains the statement
void starbar(void)
- function prototype
- function definition
- function call
- function declaration
- What is another way of writing the following statements?
if (n < m)
return (n);
else
return (m);
- return (n < m) ? n : m;
- (n < m) return ? n : m;
- return (n < m) ? return (n) : return (m);
- return (n < m) ? return (n : m);
- A function with no return value should be declared
as type ___.
- void
- int
- null
- float
- A function ___ informs the compiler which type the function
is, but the function ___ supplies the actual code.
- definition, call
- declaration, definition
- definition, declaration
- call, declaration
- When a function calls itself, it is termed ___.
- recession
- recessing
- receiving
- recursion
- What is the maximum number of times a function can
call itself?
- zero
- once
- twice
- There is no upper limit.
- With a recursive call, each call is balanced with a ___.
- prototype
- return
- argument
- EOF
- Although each level of recursion has its own ____,
the ___ itself is not duplicated.
- parameters, recursive call
- argument list, function
- set of variables, code
- prototype, function call
- Binary notation represents numbers in terms of powers of ___
- 0 or 1
- 2
- 10
- Both a and b are correct.
- In which directory would the following include file be found?
#include "hotels.h"
- system library directory
- current working directory
- system .h directory
- main .h directory
- A pointer is a variable used to store a(n) ____.
- operand
- operator
- variable
- address
- Which of the following statements will display the
address of the variable pooh, where
pooh = 24;
- printf(" %d", &pooh);
- printf(" %d", *pooh);
- printf(" %p", &pooh);
- printf(" %p", *pooh);
- In C, each function uses ___ variables.
- it's own
- shared
- duplicate sets of
- common
- Which of the following completes the swap of the
variables x and y, given the statements
temp = x;
x = y;
- y = x;
- y = temp;
- x = temp;
- temp = y;
- ___ is a pointer variable and ___ may be a regular
variable, given the statement
ptr = &pooh;
- ptr, pooh
- pooh, ptr
- Both a and b are correct.
- None of the above are correct.
- Which of the following statements finds the value
(val) that ptr, a pointer variable, points to?
- val = & ptr;
- val = * ptr;
- ptr = & val;
- ptr = * val;
- Which of the following declares pi as a pointer to int?
- int pi;
- int * (&pi);
- int & pi;
- int * pi;
- Which of the following passes the address of
x and y to the function change_them()?
- change_them( &x, &y);
- change_them( x, y);
- change_them( *x, *y);
- change_them( &(*x), &(*y));
- Given the following function call, which of the
following function headings is correct?
change_it (&x, &y);
- void change_it (int x, int y)
- void change_it (int &x, int &y)
- void change_it (int *x, int *y)
- void change_it (*int x, *int y)
- What are the values 5 and 2, given that they
are assigned to a and b, respectively, in the statement
c = diff(a, b);
- formal arguments
- informal arguments
- actual arguments
- pointer arguments
- Functions must have the same ___ as the value they return.
- value
- type
- address
- argument
|