南昌大发学C程序设计双语作业与答案.docx
- 文档编号:597189
- 上传时间:2022-10-11
- 格式:DOCX
- 页数:30
- 大小:27.36KB
南昌大发学C程序设计双语作业与答案.docx
《南昌大发学C程序设计双语作业与答案.docx》由会员分享,可在线阅读,更多相关《南昌大发学C程序设计双语作业与答案.docx(30页珍藏版)》请在冰豆网上搜索。
南昌大发学C程序设计双语作业与答案
Chapter1Introduction
1、1.Whichofthefollowingareillegalidentifiers?
Circletheillegalidentifiers.
A.3idB._yesC.star*itD.int
教师批改:
ACD
2、1.Whichofthefollowingareillegalidentifiers?
Circletheillegalidentifiers.
A.xyshouldIB.me_to-2C.one_i_aren’’tD.2_i_am教师批改:
BCD
Chapter2LearningbyExample
1、Whatiscorrectaboutthefollowingprogram?
#include
#definecount6
voidmain(void)
{
count=count+1;
printf("%d",count);
}
A.‘7‘isoutputandcountbecomes7B‘7‘isoutputandcountbecomes7C.RuntimeErrorD.‘7‘isoutputbutcountremains6教师批改:
C
2、IndicatewhichofthefollowingarelegalvariablenamesinC:
A、XB、formula1C、average_rainfallD、%correct教师批改:
ABC
3、IndicatewhichofthefollowingarelegalvariablenamesinC:
A、shortB、tinyC、totalrainfallD、aReasonablyLongVariableName教师批改:
BD
4、IndicatewhichofthefollowingarelegalvariablenamesinC:
A、12MonthTotalB、marginal-costC、b4handD、_stk_depth教师批改:
CD
5、IndicatewhichofthefollowingarelegalvariablenamesinC:
A、shortB、4formulaC、average_rainfallD、%correct
教师批改:
C
6、IndicatewhichofthefollowingarelegalvariablenamesinC:
A、shortB、formula_5C、average_rainfallD、4correct教师批改:
BC
7、IndicatewhichofthefollowingarelegalvariablenamesinC:
A、shortB、formula6C.floatD.printf教师批改:
BD
8、"Considerthefollowingcodefragment:
intdblarray[10],*dblPointer;
Whichofthefollowingstatementsarevalid(i.e.whichoneswillcompile)?
Circleallthecorrectanswers(theremaybemorethanonecorrectanswer)."
A.dblPointer=dblArray;B.dblPointer=dblArray[4];C.dblPointer=&(dblArray[2]);D.dblPointer=*dblArray;教师批改:
AC
9、Indicatethevaluesandtypesofthefollowingexpressions:
2+3value:
_______type:
_______
教师批改:
5integer
10、Indicatethevaluesandtypesofthefollowingexpressions:
19/5value:
_______type:
_______
教师批改:
3integer
11、Indicatethevaluesandtypesofthefollowingexpressions:
19.0/5value:
_______type:
_______
教师批改:
3.8double
12、Indicatethevaluesandtypesofthefollowingexpressions:
3*6.0value:
_______type:
_______
教师批改:
18.0double
13、Indicatethevaluesandtypesofthefollowingexpressions:
19%5value:
_______type:
______
教师批改:
4integer
14、Indicatethevaluesandtypesofthefollowingexpressions:
2%7value:
_______type:
_______
教师批改:
4integer
15、Byapplyingtheappropriateprecedencerules,calculatetheresultofthefollowingexpression:
6+5/4-3,resultis___________
教师批改:
4
16、Byapplyingtheappropriateprecedencerules,calculatetheresultofthefollowingexpression:
10+9*((8+7)%6)+5*4%3*2+1,resultis___________
教师批改:
42
17、Byapplyingtheappropriateprecedencerules,calculatetheresultofthefollowingexpression:
1+2+(3+4)*((5*6%7*8)-9)-10,resultis___________
教师批改:
42
18、Rewritethefollowingfloating-pointconstantsinC‘sformforscientificnotation:
29979250000.0_____________
教师批改:
29979250000
19、Rewritethefollowingfloating-pointconstantsinC‘sformforscientificnotation:
0.00000000529167_____________
教师批改:
0.00000000529
20、Evaluatethefollowingexpression:
(2Points)
inti=1,j=2,k=3,m=4;
i+=j+k;//i=______________
j*=k=m+5;//j=___________
教师批改:
618
21、Thevariablesareinitializedasfollows,
charc=‘A‘;
inti=7,j=7;
doublex=0.0,y=2.3;
Evaluatethefollowingexpressions:
(5Points)
!
c_______
!
(i-j)____________
!
i-j______________
!
!
(x+y)____________
!
x*!
!
y______________
教师批改:
01-711
22、Indicatethevaluesandtypesofthefollowingexpressions:
2%7value:
_______type:
_______
教师批改:
2integer
23、Byapplyingtheappropriateprecedencerules,calculatetheresultofthefollowingexpression:
2+2*(2*2-2)%2/2,resultis___________
教师批改:
2
24、ThefollowingCprogramiscompiledandrunssuccessfully.Writetheoutputthefollowingprogramproduces.
#include
voidmain()
{
intk=42;
printf(""%d\n"",k++);___________
printf(""%d\n"",++k);___________
return0;
}
教师批改:
4244
25、Writeaprogramthatreadsinalistofintegersuntiltheuserentersthevalue-1asasentinel.Atthatpoint,theprogramshoulddisplaytheaverageofthevaluesenteredsofar.
Chapter3ProblemSolving
1、"Whatistheoutputofthefollowingcode?
#include
voidmain(void)
{
inta;
a=1;
printf(""%i"",++a);
}
"
A.Compile-timeErrorB.0C.1D.2教师批改:
D
2、Use#definetointroduceaconstantnamedpiwiththevalue3.14159________________
教师批改:
#definepi3.14159
3、Writeaprintfstatementtodisplaythefloating-pointvaluestoredinthevariabledistancesothatexactlythreedigitsappeartotherightofthedecimalpoint___________________________
教师批改:
printf("%.3f",distance);
4、Useforcontrollinetocountfrom15to25_______________
教师批改:
for(i=15;i<=25;i++)
5、Writeaprogramthatdisplaysthemessage"Hello,world."10
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 南昌 大发 程序设计 双语 作业 答案