we have listed here some multiple choice questions with answers, which has asked by multiple companies like Oracle, Accenture, Infosys, TCS, Wipro etc.

You can prepare your job written and interview by using these sets of question from here.

1. Which of the following is not a valid variable name declaration?
a) int __a3;
b) int __3a;
c) int __A3;
d) None of the mentioned

Answer: d

2. 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
d) To avoid conflicts with environment variables of an operating system

Answer: c

3. All keywords in C are in
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned

Answer: a

4. Which of the following is true for variable names in C?
a) They can contain alphanumeric characters as well as special characters
b) It is not an error to declare a variable to be one of the keywords(like goto, static)
c) Variable names cannot start with a digit
d) Variable can be of any length

Answer: c

5. What is the output of this C code?

#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf(“Hello World! %d\n”, y);
return 0;
}
a) Compile time error
b) Hello World! 34
c) Hello World! 1000
d) Hello World! followed by a junk value

Answer: a

6. The format identifier ‘%i’ is also used for _____ data type?
a) char
b) int
c) float
d) double

Answer: b

7. What is the size of an int data type?
a) 4 Bytes
b) 8 Bytes
c) Depends on the system/compiler
d) Cannot be determined

Answer: c

8. What is short int in C programming?
a) Basic datatype of C
b) Qualifier
c) Short is the qualifier and int is the basic datatype
d) All of the mentioned

Answer: c

9. Which is correct with respect to size of the datatypes?
a) char > int > float
b) int > char > float
c) char < int < double
d) double > char > int

Answer: c

10. What is the output of this C code?

#include <stdio.h>
int main()
{
float x = ‘a’;
printf(“%f”, x);
return 0;
}
a) a
b) run time error
c) a.0000000
d) 97.000000

Answer: d

11. Which of the datatypes have size that is variable?
a) int
b) struct
c) float
d) double

Answer: b

12. What is the output of this C code?

#include <stdio.h>
int main()
{
printf(“C programming %s”, “Class by\n%s hackerthink”, “WOW”);
}
a) C programming Class by
WOW hackerthink
b) C programming Class by\n%s hackerthink
c) C programming Class by
%s hackerthink
d) Compilation error

Answer: c

13. enum types are processed by
a) Compiler
b) Preprocessor
c) Linker
d) Assembler

Answer: a

14. Which is false?
a) Constant variables need not be defined as they are declared and can be defined later
b) Global constant variables are initialised to zero
c) const keyword is used to define constant values
d) You cannot reassign a value to a constant variable

Answer: a

15. Which of the following declaration is not supported by C?
a) String str;
b) char *str;
c) float str = 3e2;
d) Both String str; & float str = 3e2;

Answer: a

16. Which of the following declaration is illegal?
a) char *str = “Best C programming classes by HackerThink”;
b) char str[] = “Best C programming classes by HackerThink”;
c) char str[20] = “Best C programming classes by HackerThink”;
d) char[] str = “Best C programming classes by HackerThink”;

Answer: d

17. Which keyword is used to prevent any changes in the variable within a C program?
a) immutable
b) mutable
c) const
d) volatile

Answer: c

18. Which is false?
a) A variable defined once can be defined again with different scope
b) A single variable cannot be defined with two different types in the same scope
c) A variable must be declared and defined at the same time
d) A variable refers to a location in memory

Answer: c

19. A variable declared in a function can be used in main().
a) True
b) False
c) True if it is declared static
d) None of the mentioned

Answer: b

20. 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

21. 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
c) -3
d) Compile time error

Answer: b

22. What is the output of this C code?

#include <stdio.h>
void main()
{
int x = 5.3 % 2;
printf(“Value of x is %d”, x);
}
a) Value of x is 2.3
b) Value of x is 1
c) Value of x is 0.3
d) Compile time error

Answer: d

23. Which of the following is not an arithmetic operation?
a) a *= 10;
b) a /= 10;
c) a != 10;
d) a %= 10;

Answer: c

24. Which of the following data type will throw an error on modulus operation(%)?
a) char
b) short
c) int
d) float

Answer: d

25. Are logical operators sequence points?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard

Answer: a