Microsoft Word



ISLAMIC UNIVERSITY OF GAZA

COMPUTER ENGINEERING DEPARTMENT

C++ PROGRAMMING LANGUAGE LAB

QUIZ # 4

Name: Number:

(Q1) Choose the best answer [5 pts]:

|أعلى النموذج |

|1-Each pass through a loop is called a/an |

|     [pic][a] enumeration |

|     [pic][b] iteration |

|     [pic][c] culmination |

|     [pic][d] pass throughأسفل النموذج |

|2-Which looping process checks the test condition at the end of the loop? |

|     [pic][a] for |

|     [pic][b] while |

|     [pic][c] do-while |

|     [pic][d] no looping process checks the test condition at the end |

|3-In a group of nested loops, which loop is executed the most number of times? |

|     [pic][a] the outermost loop |

|     [pic][b] the innermost loop |

|     [pic][c] all loops are executed the same number of times |

|     [pic][d] cannot be determined without knowing the size of the loops |

|4-What's wrong?  while( (i < 10) && (i > 24)) |

|     [pic][a] the logical operator && cannot be used in a test condition |

|     [pic][b] the while loop is an exit-condition loop |

|     [pic][c] the test condition is always false |

|     [pic][d] the test condition is always true |

|5-If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the |

|loop block? |

|     [pic][a] parentheses ( ) |

|     [pic][b] braces { } |

|     [pic][c] brackets [ ] |

|     [pic][d] arrows < > |

(Q2) What is the output of the following code fragment [1 pts]?

|int n = 0; | a.    0 0 0 0 ... forever |

|while (n < 5) |b.    1 2 3 4 |

|{ |c.    1 2 3 4 5 |

|n++; |d.    0 1 2 3 4 |

|cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download