This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Programming Using C Quiz 1
1. [20p] Deﬁne the following terms:
(a) [6p] comment
(b) [7p] variable
(c) [7p] data type
(a) [5p] What, if anything, is wrong with the following program?
(b) [15p] List all the tokens in this program and classify each as keyword,
identiﬁer, operator or special symbol.
3. [30p] What is the output of the following statements? For partial credit,
give intermediate results of subexpression evaluation.
} 1 4. [30p] Write a program that reads an integer number and determines if the
number entered represents a leap year. A leap year in general is any year
that is divisible by 4. However, there is an exception: if the number is
divisible by 100, that year is not a leap year, unless it is divisible by 400.
Thus, for example, years 2000 and 2004 were leap years, but 1900 and
1901 were not. The program should print one of 2 messages: ”This is a
leap year” or ”This is not a leap year”. 2 ...
View Full Document
- Summer '08
- Negative and non-negative numbers, Natural number, Elementary number theory, Type-token distinction