{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# quiz1 - Programming Using C Quiz 1 Name 1[20p Deﬁne the...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Programming Using C Quiz 1 Name: 1. [20p] Deﬁne the following terms: (a) [6p] comment (b) [7p] variable (c) [7p] data type 2. [20p] (a) [5p] What, if anything, is wrong with the following program? int main(){ int While; While=0; return 0; } (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. (a) [6p] printf("|%6.2d|\n",3/10); (b) [8p] int i=1; int j=i>2&&--i>0; printf("%d %d\n",i,j); (c) [8p] int i,j=2; printf("%d\n",i=2+3>2+j--&&++j==1>=0); (d) [8p] int i=1; while (i<10) { if(i%2==0) printf("%d\n",i+=2); i++; } 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

{[ snackBarMessage ]}

### Page1 / 2

quiz1 - Programming Using C Quiz 1 Name 1[20p Deﬁne the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online