General Information
- Date: Tuesday, March 5, 2019
- Time/Location: Your exam will take place in lecture.
- Duration: 75 minutes
- Closed-book, Closed-notebooks, No Computers/Calculators.
- Use a pencil/mechanical pencil (no pen) to answer the exam.
- Please take a look at the general exam rules available at
Exam Rules.
- The best way to prepare for the exam is to practice old exams. Complete several
of them in the allocated time specified in the exam.
- We curve in this course. After you taken the exam, do not discuss
anything associated with the exam with other students that have
not taken the exam yet.
- Posting any information in Piazza about the exam after taking it
is considered an academic integrity violation.
- Do not separate the pages of the exam (e.g., remove the staple). This
will interfere with the scanning process.
Exam Structure
- Short answer questions: This includes for example, multiple
choice, true/false, and fill-in-the-blank type questions.
- Code analysis questions: We will give a short segment of code and
you may be asked to identify syntax and logical errors, generate code
output, etc.
- Code Writing: Write a program/code snippets to solve a given
problem. You should be prepared to give a complete program, but we may also
ask you to provide just a single function or a code fragment.
Topics
The exam will include all the material covered in discussion session (lab),
lecture, quizzes, exercises, and projects (#1 and #2) including the following topics:
- Unix - You must be familiar with the following commands
- cp
- ls
- cd
- pwd
- gcc
- rm
- mv
- diff
- C Language
- #include and #define preprocessor directives
- Expressions
- Conditional statements
- Loops
- Arrays (1-dimensional and 2-dimensional)
- Strings - You are responsible for the following string functions:
- strlen
- strcpy
- strcmp
- strcat
- strncpy
- strncmp
- Pointers
- enum
- Structures
- Unions
- Functions
- Linkage
- Command line arguments
- Input/output redirection
- Memory maps - Please use the style provided in the following
example MemoryMapExample.pdf.
If we ask you to draw a diagram for a two-dimensional array, draw
the array using row-major order. If a variable is not initialized, use "Trash"
as its value.
Notice that old exams may draw the name of the array as a pointer;
that is not the approach we want you to use (you will lose credit).
Use the style provided in the example above.
- Recursion
The exam will NOT cover the following topics:
- Emacs, Arduino, debugger, splint, valgrind, -fmudflapth -lmudflap, bitwise operators,
make utility (makefiles), dynamic memory allocation, reading/writing from files,
function pointers
Suggestions
The following suggestions can help you write code faster during the exam.
-
Instead of
if (ptr != NULL) {
}
use
if (ptr) {
}
-
When you have nested structures defining a pointer to a field can help.
/* Using a pointer to simplify handling structure fields */
printf("Section number is %d\n", all_courses[1].section1.section_number);
printf("Section number is %d\n", all_courses[1].section1.num_students);
/* Equivalent to previous two statements */
ptr = &all_courses[1].section1;
printf("Section number is %d\n", ptr->section_number);
printf("Number of students %d\n", ptr->num_students);
-
Instead of
if (strcmp(a, b) == 0) {
}
use
if (!strcmp(a, b)) {
}
-
Instead of
while (*p != '\0') {
}
use
while (*p) {
}
Practice Material
Practice material can be found in the grace system under 216public/exams/exam1. To
transfer this material to your computer use https://dav.terpconnect.umd.edu
. Use your directory id/passwd (same one used for grace) to log on.