Review Questions

I l @ ve RuBoard

Review Questions

  1. What are the basic modules of a C program called?

  2. What is a syntax error? Give an example of one in English and of one in C.

  3. What is a semantic error? Give an example of one in English and of one in C.

  4. Ichabod Bodie Marfoote has prepared the following program and brought it to you for approval. Please help him out.

     include studio.h int main{void} /* this prints the number of weeks in a year /* ( int s s : = 56; print(There are s weeks in a year.); return 0; 
  5. Assuming that each of the following examples is part of a complete program, what will each one print?

     a. printf("Baa Baa Black Sheep.");    printf("Have you any wool?\n"); b. printf("Begone!\nO creature of lard!"); c. printf("What?\nNo/nBonzo?\n"); d. int num;    num = 2;    printf("%d + %d = %d", num, num, num + num); 
  6. Which of the following are C keywords? main , int , function , char , =

  7. How would you print the values of words and lines in the form There were 3020 words and 350 lines. ? Here, 3020 and 350 represent values for the two variables .

  8. Consider the following program:

     #include <stdio.h> int main (void) {   int a, b;      a = 5;      b = 2;    /* line 7 */      b = a;    /* line 8 */      a = b;    /* line 9 */      printf("%d %d\n", b, a);      return 0; } 

    What is the program state after line 7? line 8? line 9?

I l @ ve RuBoard


C++ Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 314
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net