Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2.
3.
4.
5.
6.
7.
8.
9.
a. -32767
b. 32767 (a)
c. 1.7014e+38
d. -1.7014e+38
The statement char c1='h' would store in c1
a. The character h
b. ASCII value of h (a)
c. h along with the single inverted commas
d. Both (a) and (b)
Which of the following statements is wrong?
a. INT=123;
b. val='A' * 'B';
c. is=20 * 'T'
d. count+5=res; (a)
The real constant in C can be expressed which of the following forms ?
a. Fractional form only
b. Exponential form only
c. ASCII form only
d. Both Fractional and Exponential (a)
C language has been developed by?
a. Ken Thompson
b. Dennis Ritchie (a)
c. Peter Norton
d. Martin Richards
A character variable can at a time score ?
a. 1 character (a)
b. 8 characters
c. 254 characters
d. None of the above
Which of the following is not a character constant?
a. 'Thank You'
b. 'quest videos- IT Learning at its best'
c. '23.56e-03'
d. All of the above
A C variable cannot start with ?
a. An alphabet
b. A number
c. A special symbol other than underscore
d. Both number and a special symbol other than underscore
C can be used on ?
a. only MS-DOS
b. only Linux
c. only window
d. All of the above
10. C programs are converted into the machine language with the help of ?
a. An editor
b. Compiler
c. An operating system
d. None of the above
11. consider the following C code,
int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;
What number will z in the sample code above contain?
a. 5
b. 6
c. 10 (a)
d. 11
e. 12
12. int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the sample code above contain?
a. 3
b. 5
c. 7
d. 9
e. 11[Ans]
13. What will be the output when following code is executed
int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
a. 12,10,11,13
b. 22,10,11,13
c. 22,11,11,11
d. 12,11,11,11
e. 22,13,13,13[Ans]
14. #define MAX_NUM 15
Referring to the sample above, what is MAX_NUM?
a. MAX_NUM is an integer variable.
b. MAX_NUM is a linker constant
b. 2 (a)
c. 3
d. 4
e. 5
20. Referring to the sample code above, what value will the variable counter have when completed?
x = 3, counter = 0;
while ((x-1))
{
++counter;
x--;
}
a. 0
b. 1
c. 2 (a0
d. 3
e. 4
21. Which one of the following C operators is right associative?
a. = (ans)
b. ,
c. ==
d. <e. ->
22. When applied to a variable, what does the unary "&" operator yield?
a. The variable's value
b. The variable's binary form
c. The variable's address [Ans]
d. The variable's format
e. The variable's right value
23. Which of the following is not a valid variable name declaration?
a. int __a3;
b. int __3a;
c. int __A3;
d. None of the other answers
24. Which of the following is not a valid variable name declaration?
a. int _a3;
b. int a_3;
c. int 3_a;
d. int _3a
e. None of the other answers
25. Variable names beginning with underscore is not encouraged. Why?
a. It is not standardized
b. To avoid conflicts since assemblers and loaders use such names
c. To avoid conflicts since library routines use such names (ANS)
d. To avoid conflicts with environment variables of an operating system
26. All keywords in C are in
a. LowerCase letters (ANS)
b. UpperCase letters
c. CamelCase letter
d. None
27. What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 5;
i = i / 3;
printf("%d\n", i);
return 0;
}
a. Implementation defined
b. 1(a)
c. 3
d. Compile time error
28. What is the output of this C code?
#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y || z++;
printf("%d", z);
}
a.
b.
c.
d.
6 (a)
5
0
Varies
a.
b.
c.
d.
hi
hello
no
None of the mentioned
#include <stdio.h>
void main()
int x = 5;
if (true);
printf("hello");
#include <stdio.h>
void main()
int x = 0;
if (x == 0)
printf("hi");
else
printf("hello");
a. hi
b. how are you
c. hello
d. hihello (A)
32. What is the output of this C code?
#include <stdio.h>
int main()
int x = 1;
if (x > 0)
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
a. inside if (A)
b. inside elseif
c. inside if
d. inside elseif
e. Compile time error
#include <stdio.h>
int main()
int x = 0;
if (x++)
printf("true\n");
else if (x == 1)
printf("false\n");
}
a. true
b. false (A)
c. Compile time error
d. Undefined behavior
34. What is the output of this C code(when 1 is entered)?
#include <stdio.h>
void main()
double ch;
scanf("%lf", &ch);
switch (ch)
case 1:
printf("1");
break;
case 2:
printf("2");
break;
}
a. Compile time error
b. 1 (a)
c. 2
d. Varies
35. What is the output of this C code?
#include <stdio.h>
int main()
int i = 3;
int l = i / -2;
int k = i % -2;
return 0;