本答案对应课程为:点我自动跳转查看
本课程起止时间为:2019-09-23到2019-12-06
本篇答案更新状态:已完结

【作业】Chapter 4. C Program Repetition Structure 实验一:分支与循环

1、 问题:设计一个程序,提示用户输入两个数字,每个数字的输入以回车结束。使用选择结构判断用户输入的两个数字的大小,如果相同,则输出0;如果不相同,则输出较大的数。
建议:【本题是主观题,暂无解析】

2、 问题:设计一个程序,提示用户输入五个学生的考试成绩,使用选择和循环结构来判断并统计及格学生的人数,并输出统计结果。
建议:【本题是主观题,暂无解析】

3、 问题:设计一个程序,计算并输出正整数n的阶乘n!,其中n的值由用户输入。
建议:【本题是主观题,暂无解析】

4、 问题:设计一个程序,求出所有的水仙花数。提示:所谓的“水仙花数”是指一个三位的正整数,其各个数字的立方和等于该数本身,例如:15^3=1^3+5^3+3^3,153就是“水仙花数”。15^3表示15的三次方。
建议:【本题是主观题,暂无解析】

5、 问题:用户输入任意秒数,将其转换为小时:分钟:秒的表示形式。例如,用户输入3600,程序显示1:00:00。
建议:【本题是主观题,暂无解析】

Chapter 5. Functions 阶段复习测验

1、 问题:Which operation will find the remainder when 15 is divided by 6?
选项:
A:15 / 6
B:15 % 6
C:15 ^ 6
D:15 * 6
答案: 【15 % 6

2、 问题:Evaluate the expression3 * 4 % 6 + 4 *5
选项:
A:20
B:26
C:12
D:32
答案: 【20

3、 问题:a * (b + c) may also be written in C as
选项:
A: ab + ac
B:(a * b ) + c
C:a * b + c
D:a * b + a * c
答案: 【a * b + a * c

4、 问题: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
答案: 【an infinite number of times

5、 问题:Consider the following correct segment of a correct C program: p = 2; while (p < 2000) { p = 2 * p; }What is the value of p after this while loop completes its execution?
选项:
A:1023
B:1024
C:2047
D:2048
答案: 【2048

6、 问题:What is the final value of x after performing the following operations?int x = 21;double y = 6;double z = 14;y = x / z;x = 5.5 * y;
选项:
A:8.25
B:5.5
C:5
D:8
答案: 【8

7、 问题:Which of the following will not increment variable c by one?
选项:
A:c + 1;
B:c++;
C:++c;
D:c += 1;
答案: 【c + 1;

8、 问题:In which of the following is y not equal to 5 after execution? Assume that x is equal to 4.
选项:
A:y = 5;
B:y = x++;
C:y = ++x;
D:y = x = 5;
答案: 【y = x++;

9、 问题: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
答案: 【body statement of the loop

10、 问题: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
答案: 【print the numbers 1 through 10

11、 问题:The condition num != 65 cannot be replaced by:
选项:
A:num> 65 || num< 65
B:!(num == 65)
C:num – 65
D:!(num – 65)
答案: 【!(num – 65)

12、 问题:Consider the following code, assuming that x is an integer variable with an initial value of 12: if(x = 6) {printf(“%i”, x); } What is the output?
选项:
A:6
B:12
C:nothing
D:a syntax error is produced
答案: 【6

13、 问题:If a = 7.0, b = 7.0 and c = 6.0, then what is printed byprintf(“%.2f”, sqrt(a + b * c));
选项:
A:49
B:7.00
C:7
D:49.00
答案: 【7.00

14、 问题:Which of the following code segments does not contain any errors?
选项:
A:void printnum(int x){ print(“%i”, x); return x;}
B:int cube(int s){ int s; return(s * s * s);}
C:double triple(float n) { return(3 * n); }
D:double circumference (int r)return(3.14 * 2 * r);

本门课程剩余章节答案为付费内容
本文章不含期末不含主观题!!
本文章不含期末不含主观题!!
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦

   

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注