0% found this document useful (0 votes)
90 views

MC With Answers

C programming MCQ

Uploaded by

Sri Sri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

MC With Answers

C programming MCQ

Uploaded by

Sri Sri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1. Who is father of C Language?

A. Bjarne Stroustrup B. Dennis Ritchie C. James A. Gosling D. Dr. E.F. Codd


Answer : B

2. C Language developed at _____?


A. AT & T's Bell Laboratories of USA in 1972 B. AT & T's Bell Laboratories of USA in 1970
C. Sun Microsystems in 1973 D. Cambridge University in 1972
Answer : A

3. For 16‐bit compiler allowable range for integer constants is ______ ?


A. ‐3.4e38 to 3.4e38 B. ‐32767 to 32768 C. ‐32768 to 32767 D. ‐32668 to 32667
Answer : C

4. C programs are converted into machine language with the help of


A. An Editor B. A compiler C. An operating system D. None of the above
Answer : B

5. A C variable cannot start with


A. An alphabet B. A number C. A special symbol other than underscore
D. both (b) and (c)
Answer : D

6. Which of the following is allowed in a C Arithmetic instruction


A. [] B. {} C. () D. None of the above
Answer : C

7. Which of the following shows the correct hierarchy of arithmetic operations in C


A. / + * ‐ B. * ‐ / + C. + ‐ / * D. * / + ‐
Answer : D

8. What is C Tokens?
A. The smallest individual units of c program B. The basic element recognized by the compiler
C. The largest individual units of program D. A & B Both
Answer : D

9. What is Keywords?
A. Keywords have some predefine meanings and these meanings can be changed.
B. Keywords have some unknown meanings and these meanings cannot be changed.
C. Keywords have some predefine meanings and these meanings cannot be changed.
D. None of the above
Answer : C

10. What is constant?


A. Constants have fixed values that do not change during the execution of a program
B. Constants have fixed values that change during the execution of a program
C. Constants have unknown values that may be change during the execution of a program
D. None of the above
Answer : A

11. Which is the right way to declare constant in C?


A. int constant var =10; B. int const var = 10; C. const D. B & C Both
Answer : D

12. Which operators are known as Ternary Operator?


A. ::, ? B. ?, : C. ?, ;; D. None of the above
Answer : B

13. What will be the output of the following arithmetic expression ? 5+3*2%10‐8*6
a) ‐37 b) ‐42 c) ‐32 d) ‐28
Ans: a

14. Who is father of C Language?


Bjarne Stroustrup B. James A. Gosling C. Dennis Ritchi D. Dr. E.F. Codd

15. What will be the output of the following statements ?


int a = 4, b = 7,c; c = a = = b; printf("%i",c);
a) 0 b) error c) 1 d) garbage value
Ans: a

15. What will be the output of the following statements ? int i = 1,j; j=i‐‐‐ ‐2; printf("%d",j);
a) error b) 2 c) 3 d) ‐3
Ans: c

16. What will be the output of the following statements ? int i = 3; printf("%d%d",i,i++);
a) 34 b) 43 c) 44 d) 33
Ans: b

17. A C variable name can start with a ____


A. Number B. Plus Sign (+) C. Underscore D. Asterisk (*)

18. 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
Answer: c

19. Which is valid C expression?


a) int my_num = 100,000; b) int my_num = 100000;
c) int my num = 1000; d) int $my_num = 10000;
Answer: b

20. Step by step instructions written to solve any problem is called


[A] pseducode [B] algorithm [C] assembler [D] class
Answer: Option B 2.

21. Diagrammatic or symbolic representation of an algorithm is called


[A] Data-Flow diagram [B] E-R diagram [C] Flowchart D] None of the above Answer
Answer: Option C

22. Which of the following operator takes only integer operands?


A. + B. * C. / D. %
23. What is the output of this C code?
#include <stdio.h>
int main()
{
int c = 2 ^ 3;
printf("%d\n", c); }
a) 1 b) 8 c) 9 d) 0
Answer: a

24. What is the output of this C code?


#include <stdio.h>
int main()
{
int a = 2;
if (a >> 1)
printf("%d\n", a);
}
a) 0 b) 1 c) 2 d) No Output.
Answer: c

25. What is the output of this C code?


#include <stdio.h>
int main()
{
int i = -3;
int k = i % 2;
printf("%d\n", k);
}
a) Compile time error b) -1 c) 1 d) Implementation defined
Answer: b

26. What is the output of this C code?


#include <stdio.h>
int main()
{
int i = 3;
int l = i / -2;
int k = i % -2;
printf("%d %d\n", l, k);
return 0;
}
a) Compile time error b) -1 1 c) 1 -1 d) Implementation defined
Answer: b

27.What is the type of the below assignment expression if x is of type float, y is of type int? y=x
+ y;
a) int b) float c) there is no type for an assignment expression d) double
Answer: a

28.To print a float value which format specifier can be used?


A - %f B - %lf C - %Lf D - None of the above

29. Choose the function that is most appropriate for reading in a multi-word string?
A - strnset() B - scanf() C - strchr() D - gets()

30. 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) 6 b) 5 c) 0 d) Varies
Answer: a
31. 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) 6 b) 5 c) 0 d) Varies
Answer: b

32. What is the output of this C code?


#include <stdio.h>
int main()
{
int x = 1, y = 0, z = 3;
x > y ? printf("%d", z) : return z;
}
a) 3 b) 1 c) Compile time error d) Run time error
Answer: c

33. The number of digits present after decimal in float is________


a) 1 b) 3 c) 6 d) 16
Answer: c

34.In a 32-bit compiler, which 2 types have same size?


a) char and short b) short and int c) int and float d) float and double
Answer: c

35. What is the size of float in a 32-bit compiler?


a) 1 b) 2 c) 4 d) 8
Answer: c

36. %Lf access specifier is used for


a) Strings b) Integral types c) Floating type d) Long Float
Answer: c

37. What is the sizeof(char) in a 32-bit C compiler?


a) 1 bit b) 2 bits c) 1 Byte d) 2 Bytes
Answer: c
38. Which of the following is not an operator in C?
a) , b) sizeof() c) ~ d) None of the mentioned
Answer: d

39.Which among the following has the highest precedence?


a) & b) << c) sizeof() d) &&
Answer: c

40.What type of value does sizeof return?


a) char b) short c) unsigned int d) long
Answer: c

41. . Which data type is suitable for storing a number like? 10.0000000001
a) int b) float c) double d) both float and double
Answer: c
42. Execution of a program starts with
a) #include statement b) Pre-processor directive c) Main() d) None of the above
43. The output of the code below is
#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}
a) hi b) hello c) no d) none of the mentioned
Answer: a

44. scanf returns as its value


a) Number of successfully matched and assigned input items b) Nothing
c) Number of characters properly printed d) Error
Answer: a

45. Double is of ____ bytes wide


a) 4 b) 8 c)10 d) 12

46. Associativity of an operator are:


a) Right to Left b) Left to Right c) Random fashion d) Both Right to Left and Left to Right
Answer: d

47. Which of the following method are accepted for assignment?


a) 5 = a = b = c = d; b) a = b = c = d = 5; c) a = b = 5 = c = d; d) None of the mentioned
Answer: b

48. Standard ANSI C recognizes ______ number of keywords?


A.30 B. 32 C.24 D.36

49. Which one of the following is not a reserved keyword for C?


A.auto B.case C. main D.default

50. putchar(c) function/macro always outputs character c to the


a) screen b) standard output c) depends on the compiler d) depends on the standard

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy