quiz1 - Programming Using C Quiz 1 Name: 1. [20p] Define...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
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] Define 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, identifier, 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

This note was uploaded on 07/08/2011 for the course CGS 3460 taught by Professor Staff during the Summer '08 term at University of Florida.

Page1 / 2

quiz1 - Programming Using C Quiz 1 Name: 1. [20p] Define...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online