C语言英文面试题

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Ⅰ.Choose the right answer (30 marks).
1.Determine the output of the following statement:
printf("%d", 'M' - 'N');
A)'M' - 'N' B) M - N
C)3 D) 1
2.Which of following is an illegal user-define symbol?
A) scanf B) _123 C)C$ D)var
3.Which statement is not a C statement?
B){int a; a++;} B)z = 20, a += c;
C) ;D) { ; }
4. Which operator can only be applied to integers?
A) %= B) /
C) = D) <=
5. Determine the output of the following program.
void main()
{
int y=8,x=7;
printf("%d ,%d\n", ++x, y++);
}
A) 7,8 B) 9,7 C) 8,8 D) 8,9
6. Choose the wrong definition for the character strings.
A) char str[4]= “QUST”;B) char str[]= “QUST”;
C) char *str= “QUST”;D) char str[]={…Q‟, …U‟, …S‟, …T‟, …\0‟};
7. Determine the output of the following program.
void main()
{
int i, j, m = 0;
for(i=1;i<=15;i+=5)
for(j=3;j<=19;j+=3)
m++;
}
printf("%d\n",m);
A) 12B) 15C) 18D) 25
8. For the 2-dimensional array int b[][3]={{1,0,-1},{10,12},{8,3,9},{0}}; the value for the b[2][1] is______.
A) 8 B) 5 C)3 D) 12
9. In the statement while(x), choose the equivalent expression for the x.
A)x==0 B)x==1 C)x!=1 D)x!=0
10.For the following codes: int z=5, *p=&z; the value of the *p is_______.
A)the address of c B)unknown value
C)the address of p D)5
11. In order to assign 45 to variant a and assign 64 to variant b with the statement scanf(“%d%d”, &a, &b), which input format is correct?
A) 45 64B) 45, 64
C) 45;64 D) 4564
12. What is the byte length of the string “\t\\abcd”.
A) 6 B) 7
C) 8 D) 9
13. Determine the output of the value of b.
Int a[4][2] = {1,2,3,4,5,6,7,8};
b = *(*(a + 2) + 1);
A) 3 B) 4 C) 5 D) 6
14.Determine the output of the following program:
main()
{
int n = 8;
while (n > 5)
{
n--;
printf(“%d”, n);
}
}
A) 876 B) 765 C) 8765 D) 7654
15. What is the functionality of function “rewind”?
A) open the file again;
B) return the length of the file
C) push the pointer to the end of the file
D) push the pointer to the beginning of the file
II. Short answer questions.(30 marks)
1. a. Enumerate workflow control methods in C programming language. (5
marks)
b.Give a simple C program to show the basic parts of a C program.(5 marks)
2. a. The following program takes user input number and display the
multiplication result of (num + num) in the next line on the screen, but it alway displays the wrong result. Determine where the errors are and why the program
can never give the correct result. (8 marks)
#include <stdio.h>
void main()
{
int num;
printf("Enter a letter: ");
scanf("%d", num);
num = num * num;
printf("The result of num + num is %d", &num);
}
b. Modify the program so it will display the proper result. (12 marks) III. Write the programs. (40 marks)
1. Given an array a[9], fill a with random values, then write a sorting method to
sort the data in a and display the result.. (10 marks)
2. (a) Write a function named min( ) that accepts 5 integers as input , which
calculates and returns the maximum value among them. The 5 integer numbers should be arrange into an integer array, and passed to the function min( ). (5 marks)
(b) Include the function in a working program. Make sure your function is
called from main() and correctly returns a value to main(). Display the value returned by min() in main(). (5 marks)
3. Write a program that declares a single-dimensional arrays named num,. The
numbers to be stored in num are 45, 86, 12, 37, 28, 113. Sum odds and evens separately. Finally, give the results that will be displayed on the screen. (10 marks)
4. Given a function:
2020,10101003102≥<≥<⎪⎩⎪⎨⎧--=x x x x x x x y
Write a program to accept the user input for x , and display the value of y .。

相关文档
最新文档