1. What is the final value of ? after performing the following operations - PowerPoint PPT Presentation

About This Presentation
Title:

1. What is the final value of ? after performing the following operations

Description:

Title: PowerPoint Presentation Author: Jodi Neely-Ritz Last modified by: Jodi Neely-Ritz Created Date: 2/24/2004 8:29:04 PM Document presentation format – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 8
Provided by: JodiNee4
Learn more at: http://plaza.ufl.edu
Category:

less

Transcript and Presenter's Notes

Title: 1. What is the final value of ? after performing the following operations


1
Example Problems for Exam2 (covers chapters 5,
6, 7, 8, 9)
1. What is the final value of ? after performing
the following operations int x 24 float y
6.0 float z 3.0 y x / z ? 2.0
y (a) 12 (b) 12.0 (c) 16 (d) 16.0
ANS (d)
2
2. What is the lowest value of the loop counter
in a for statement with the following header?
for ( i 10 i gt 1 i -1) a) 10 b) 9 c)
1 d) 0
ANS (d)
3
3. An array containing 3 columns and 4 rows is
typically referred to as a ________. a)
12-element array b) 3-by-4 array c) 13-element
array, because of the zero element d) 4-by-3 array
ANS (d)
4
4. An incorrect final value in a loop counter
(increment or decrement) or an incorrect
relational operator in the conditional expression
of a while or for loop statement frequently
causes an __________error. off-by-one
5. The function body, is represented by _____ in
the following function definition W X(Y)
Z (a) W (b) X (c) Y (d) Z
ANS (d)
5
6. The following array definition int n4
51, 36, 22, 45, 17 a) is correct b) causes
a syntax error because there are only four
initializers and five array elements. c) causes a
logic error because there are only four elements
but there are five initializers. d) causes a
syntax error because there are five initializers
but only four array elements.
ANS (d)
6
7. When exit is called with EXIT_SUCCESS
exit(EXIT_SUCCESS) (a) the program quits
immediately without returning anything (b) the
program prints an exit_success message and quits
the current function (c) the implementation
defined value for normal termination is
returned (d) the program breaks out of a loop
ANS (c)
7
8. Which statement of the following is
correct? (a) define X 3 (b) define X 3 (c)
define X 3 (d) define X3
ANS (c)
Write a Comment
User Comments (0)
About PowerShow.com