ET2560 Introduction to C Programming Chapter 5

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What are the values of n, m, and p after execution of this three-statement fragment? j5 k2 n = j - ++k; m = j-- + k--; p = k + j;

n=2, m=8, p=6

What does the following code segment display? Try each of these inputs: 345, 82, 6. Then, describe the action of the code. printf (*\nEnter a positive integer> "); scanf (*%d, &num);do { printf ("%d ", num % 10);num / = 10;} while (num > 0); printf ("\n");

. Enter a positive integer> 345 543 Enter a positive integer> 82 28 Enter a positive integer> 6 6 The code displays the digits of an integer in reverse order and separated by spaces.

During execution of the following program segment, how many lines of asterisks are displayed? for (i = 0; i < 10; ++i) for (j = 0; j < 5; ++j) printf("**********\n");

50

Some for loops cannot be rewritten in C using a while loop. True or false?

false

During execution of the following program segment: a. b. c. How many times does the first call to printf execute? How many times does the second call to printf execute? What is the last value displayed? for (i = 0; i < 7; ++i) { for (j = 0; j < i; printf("%4d", i * j); printf("\n"); ++j) }

a. 0+1+2+3+4+5+6=21 b. 7 c. 30

If the value of n is 4 and m is 5, is the value of the following expression 21? ++(n * m) Explain your answer.

a. 0+1+2+3+4+5+6=21 b. 7 c. 30

In a typical counter-controlled loop, the number of loop repetitions may not be known until the loop is executing. True or false?

false

It is an error if the body of a for loop never executes. True or false?

false

In an endfile-controlled while loop, the initialization and update expressions typically include calls to the function ___________.

scanf

A loop that continues to process input data until a special value is entered is called a ___________ -controlled loop.

sentinel

What are the values of x, y, and z after execution of this three-statement fragment?

x=21, y=1, z=23


Set pelajaran terkait

Emerging Technologies (Lesson 3)

View Set

Short Story Literary Terms Study Guide

View Set

Ch_3_Interaction of X-Radiation With Matter

View Set

Managerial Accounting RQ Chapter 13 #1

View Set

Chapter 7 (Energy and Metabolism) and Chapter 8 (Cellular Respiration)

View Set

PNE 105 Chapter 46: Caring for Clients with Disorders of the Lower GI Tract. Med-Surg.

View Set

nclex pn safe, effective care environment

View Set

AP Calculus AB Unit 1: Limits and Continuity

View Set

Medical-Surgical: Immune and Infectious

View Set