Question
(The programming language is C) Multiple choice 2-1 Which expresss value is 0? A. 3%5; B. 3/5.0; C. 3/5; D. 3 <5; 2-2 Among the
(The programming language is C)
- Multiple choice 2-1 Which expresss value is 0? A. 3%5; B. 3/5.0; C. 3/5; D. 3<5;
2-2 Among the following assignments or initializations, __ is wrong. A. char s[ ]="hello"; B. char s[10]; s="hello"; C. char *p="hello"; D. char *p; p="hello";
2-3 Suppose variable x, y and t are defined. Which statement can not swap xs value and ys value? A. x=x+y, y=x-y, x=x-y;
B. t=x, x=y; y=t; C. t=y, y=x, x=t;
D. x=t, t=y, y=x;
2-4 According to the declaration: int a[3][4]={0}; the correct description is __. A. Only the initial value of a[0][0] is 0. B. This declaration is not correct. C. Every element in the array can get its initial value, but may not be 0; D. Every element in the array has initial value 0.
2-5 Which is the valid variable name in the follows? A. float
B. -fx_1 C. sum_
D. M.z
2-6 After performing the following code fragment, what are the values of x and y int x=3,y=2; if(x>y) x++; y++; A. x=3,y=3
B. x=3,y=2 C. x=4,y=3
D. x=4,y=2
2-7 According to the declaration: int a=17; the value of expression a++*1/3 is __. A. 5
B. 6 C. 5.666667
D. 18
2-8 The output of this program is ( ). #define add(a,b) a+b int main(){ printf("%d ",5*add(3,4)); return 0; } A . 35
B . 19
C. 0
D. Syntax error
2-9 With the following definition, which statement is wrong? struct pupil{ char name[20]; int age; int sex; }pup[5]; A. scanf("%s", &pup[0].name);
B. scanf("%d", &pup[1].age); C. scanf("%d", &pup[2].sex);
D. scanf("%s", pup[4].name);
2-10 If all variables have been defined and declared in the following program, all the variables which can be used in function fun() are __. void fun(int x) { static int y; } int z; void main( ) { int a,b; fun(a); } A. x,y
B. x,y,z C. a,b,y,z
D. a,b,x,y,z
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started