CSCE 150A (Fall 2009) Final Exam Review
You are not allowed to use any calculators, computers, or other computing
devices on the exam.
You may use as a reference one 8.5" × 11" sheet of paper,
with whatever content you wish written on both sides.
You are not allowed to use your textbook or any
other reference material. You will have 120 minutes to complete the exam.
- From the midterm:
- Basic C: preprocessor directives, standard libraries,
comments, reserved words
- #include<stdio.h>,
#include<math.h>,
#define
- /* ... */ vs
// ...
- int,
double, char, main, etc.
- Variables: identifier rules, types, precision, scope
- What is a valid identifier name? What makes one invalid?
- What are the basic data types we've covered? What range of values
can they take on?
- What are variable scoping rules?
E.g. what is the output of the following program?
#include<stdio.h>
int function(int a, int b);
int main()
{
int z=5, y=10, x=1;
x = function(z, y);
printf("x = %d, y = %d, z = %d\n", x, y, z);
}
int function(int a, int b)
{
int z;
z = 3;
b = 15;
return a * b;
}
Input/Output:
scanf and printf,
fscanf and fprintf
C Expressions: arithmetic operators, type casting, order of
precedence
Functions: library functions, prototypes, return types,
parameters
- sin, cos, sqrt, pow, etc.
- E.g. in above code, what is output by
printf("%d\n", function(function(2,3), function(4,5)));
Conditionals: if, if-then-else, switch statements, logical
operators, short-circuiting
- &&, ||, ==, !=,
<, <=, >, >=, !
- What is result of e.g.
(x == 0) || (x != 0)
- What happens if
we know that the first part of a logical OR (||) is true?
From the final:
- Loops: while, for, do-while, nested loops, indexing arrays in loops,
increment and decrement operators
- Arrays: one-dimensional, multi-dimensional, array initialization,
array indexing, passing arrays as function arguments, modifying arrays within a
function, preventing modification of arrays within a function, searching and
sorting arrays.
- Strings: arrays of characters with null terminating character,
accessing individual characters in it, string functions like strcpy,
strncpy, strcmp, etc. Use of strings in printf and
scanf. Modifying strings within a
function, preventing modification of strings within a function
- Reading command line arguments
- Character analysis and conversion functions; string-to-number and
number-to-string conversions
- Structures: typedef to define new types, declaring variables and
arrays of a user-defined type, accessing member variables of a structure
Last modified 16 August 2011; please report problems to
sscott.