浙大14年C语言专题试卷-英文

更新时间:2023-07-04 14:45:18 阅读: 评论:0

浙江大学2014–2015学年冬季学期
《程序设计基础》课程期末考试试卷
课程号:  211Z0040  开课学院:  计算机学院__
考试试卷:√A卷、B卷(请在选定项上打√)
考试形式:√闭、开卷(请在选定项上打√),允许带 入场
考试日期: 2015 01 28 ,考试时间: 120 分钟
诚信考试,沉着应考,杜绝违纪.
考生姓名:              学号:              所属院系:            _
(注意:答题内容必须写在答题卷上,写在本试题卷上无效)
Section 1: Single Choice(2 marks for each item, total 20 marks)
1. Which one below is NOT a valid identifier in  the C programming language? _____.
A. printf
B. _ever   
C. “char”
D. true
岳阳楼记多少字
2. Given a, b and c as three double variables, which one below is NOT equivalent to a/b/c? _____.
A. (a/b)/c
B. a/(b/c)   
C. a/(b*c)
D. a/c/b
3. Which function header is NOT correct? _____.
A. void f(void)
B. void f(int i)   
C. void f(int i,j)
D. void f(int i, int j)
4. Given the code below, what will be the value of i after the loop? _____.
int i;
while ( i<10 )  i++;
A. 10
B. 11   
C. 9
D. None of above.
5. Given the declarations: int a[5], *p=a; which expression is equivalent to the expression p+1  ? _____.
Aa[1]
B. &a+1
Ca+1
D. p[2]-1
6. For the declarations: int a[]={1,2,3,4,5},*p=a+1, y; what will be the value of variable y  after executing y=(*p)++; ? _____.
Ay=1
By=2
Cy=3
D. Syntax error.
7. For the declarations: int *p[2], n[5]; which assignment expression is correct? _____ .
Ap=n
B. p=&n[0]
Cp[0]=n
D. p[0]=n++
8. Given the following code fragment, the loop condition str[i]!=’\0’梆笛 could be replaced by which choice? ______.
char str[20]=”hello, world”;
for (i = 0; str[i] != ‘\0’; i++) putchar(str[i]);
就业补贴申请条件
Astr[i]
Bi < 20
C!(str[i] = ‘\0’)
Di <= 20
9. Which function-calling statement could be ud, to open a text file entitled “t” and located in the folder “ur” within D diskette, which is opened for the reading and writing operation? ______.
Afopen("D:\","r")
B. fopen("D:\\ur\\","r+")
C. fopen("D:\","rb")
Dfopen("D:\\ur\\","w")
10. In the following code fragments, which item is completely correct? ______.
Aint *p[5];  scanf("%d", p[0]);
Bint *p;  scanf("%d", p);
Cint n[10], *p=n;  scanf("%d", p);
母爱滋润我成长
Dint n, *p;  *p= &n;  scanf("%d", p);
给我机会
Section 2: Fill in the blanks2 marks for each item, total 30 marks
1. The value of expression 3/6*2.0 is ________.
2. The value of expression '9'-'0' is _______.
3. Given:
char c = 255;
printf("%d", c);
The output should be: _______.
4. Given:
    int b=50;
if ( 1<b<10 ) printf("ok") el printf("no");
the output is _______.
5. The following code fragment will print out _____________________________.
void swap(int *pa, *pb)
{
int *t = pa;
pa = pb;
pb = t;
      }
int a = 1, b = 2;
      swap(&a, &b);
      printf(“%d#%d#”, a, b);
6. The output of the code below is ________.
char *s=”abc”;
while ( *s++ ) if (*s) putchar(*s-1);
7. Given the declaration: char *s;, write a statement which could be ud to allocate 10 bytes from the system and assign the first address to the variable s _____________.
8. Try to u the function-call of 我是主持人fscanf, to replace the function-call of scanf(”%d”,&m); ______________________________________________.
9. Given the declaration: char *s; , write an expression without any function-calling, which is equivalent to the expression strlen(s)==1 _____________________.
10. Given the declaration: int a[3][2]={1,2,3,4,5,6}; what is the value of expression (a[1]+1)[0] ?____________.
11. The value of expression !*(“2015-01-28”+5) is ______________.
12. The output of the code below is ________.
char x[ ]=”hello,world\012345”;
printf(”%d#%d#”sizeof(x)strlen(x));
13. The output of the code below is ________.
char *a[3]={"one", "two",”three”}, **p=a;
printf("%s#", *(++p)+1);
printf("%c#", **p-1);   
14. Given the declarations: FILE *infp, *outfp;, write a statement: it is ud to write a letter, which is read from a file pointer infp, into the file pointer outfp, which points to an output file. ________________________________________________________.
15. Given the declaration: char s[10]=”12345678”; what will be the value of strlen(s) after executing strcpy(s+2,s+5); ________.
Section 3: Read each of the following programs and answer questions (marks for each item, total 30 marks)
1. What is the output of the following program? _____________________________.
#include <stdio.h>
void swap(int *a, int b)
{   
int m, *n;
   
n=&m;
    *n=*a;
    *a=b;
    b=*n;
}
int main()
{   
int x=8,y=1;
    swap(&x,y);
    printf("%d#%d#",x,y);
}
2. When input: 123, what is the output of the following program_______________. 
#include <stdio.h>
int f(char s[], int b)
{
int i=0, n=0;
      while (s[i]!=’\0’) {
              n=n*b+s[i]-'0';
          i++;
}
    return n;
}
int main()
{
char s[20];
      int n;
悲剧的诞生 
    scanf("%s",s);
printf("%d", f(s,5));
}
3. 最新的歌When the following program’s input is
ing<Enter>
This is a long test string<Enter>

本文发布于:2023-07-04 14:45:18,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1078089.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:考试   答题   选定
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图