How many times will the following program print hello?i = 1;while (i <= 10){ puts(“hello”); }()
A. 10
B. 8
C. an infinite number of times
D. 0
查看答案
What is the output of code corresponding to the following program segment if Age=18?if(age>=18) printf(“You are eligible to vote.”);else vote = age-18; printf(“You can vote in %d years”, vote)()
A. You are eligible to vote
B. You can vote in 18 years
C. You can eligible to vote.Your can vote in 0 years
D. You can vote in 0 years
The program segment int counter = 1;do {printf(“%i”, counter);} while(counter <= 10); will__()
A. print the numbers 1 through 11
B. print the numbers 1 through 10
C. print the numbers 1 through 9
D. cause a syntax error
Which of the following is not specified by the following code segment:for(c = 1; c <= 10; c++)()
A. initial value of the loop counter
B. loop continuation test
C. increment of the loop counter
D. body statement of the loop
有以下程序:#includeint main(){ int flag = 0; if (flag = 1) { if (flag != 0) printf(“Hello World”); else printf(“Hi World”); } else if (flag) printf(“Hhhh”); else printf(“good bye”);}程序运行后的输出结果是()
A. Hello World
B. Hi World
C. Hhhh
D. good bye