C Programming MCQ Questions | c interview questions

Introduction

In this article, you will find basic to most puzzled interview queries questions. This article is very useful for those who are preparing for an interview in IT company. Whether you are experienced or

techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999


1) What are the types of linkages in C programming language?
  1. Internal
  2. External and None.
  3. External, Internal and None.
  4. Internal and External.

⇒ Answer: (C) External, Internal and None.

2) Which of the following special symbol allowed in C programming language variable name?
  1. _ (underscore)
  2. - (hyphen)
  3. | (pipeline)
  4. * (asterisk)

⇒ Answer: (A) _ (underscore).

3) Which of the following statements should be used in C programming to obtain a remainder after dividing 4.14 by 2.3 ?
  1. rem = fmod(3.14, 2.1);
  2. rem = modf(3.14, 2.1);
  3. rem = 3.14 % 2.1;
  4. Remainder cannot be obtain in floating point division.

⇒ Answer: (A) rem = fmod(3.14, 2.1);

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

⇒ Answer: (B) Variable names cannot start with a digit

5) Which of the following is not a valid C programming language variable name?
  1. int $main;
  2. int variable_count;
  3. float rate;
  4. int number;

⇒ Answer: (A) int $main;

     

6) What will be the output of the following C code?

  1. #include <stdio.h>
  2. int main()
  3. {
  4. printf("Hello World! %d \n", a);
  5. return 0;
  6. }
  1. Hello World!
  2. Compile time error
  3. Hello World! followed by a junk value
  4. Hello World! a;

⇒ Answer: (B) Compile time error

Explanation: since a is used without declaring the variable a.


7) What will be the output of the following C code?

  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a = 10000;
  5. int a = 34;
  6. printf("Hello World! %d\n", a);
  7. return 0;
  8. }
  1. Hello World! followed by a junk value
  2. Hello World! 1000
  3. Hello World! 34
  4. Compile time error

⇒ Answer: (D) Compile time error

Explanation: Since a is already defined, redefining variable a results in an error.


8) What will be the output of the following C code?

  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a = 10000;
  5. int a = 34;
  6. printf("Hello World! %d\n", a);
  7. return 0;
  8. }
  1. 10
  2. 20
  3. The program will have a runtime error
  4. Compile time error

⇒ Answer: (A) Variable names Number and number are both distinct as C is case sensitive programming language.

9) What will be the output of the following C code?

  1. #include <stdio.h>
  2. int main()
  3. {
  4. int main = 20;
  5. printf("%d", main);
  6. return 0;
  7. }
  1. It will experience infinite looping
  2. It will run without any error and prints 20
  3. It will cause a run-time error
  4. It will cause a compile-time error

⇒ Answer: (B) It will run without any error and prints 20

10) Which of the following is not a valid variable name declaration in C programming language?

  1. #include <stdio.h>
  2. int main()
  3. {
  4. int main = 20;
  5. printf("%d", main);
  6. return 0;
  7. }
  1. #define PI 3.14
  2. int PI = 3.14;
  3. double PI = 3.14;
  4. float PI = 3.14;

⇒ Answer: (A) #define PI 3.14

« 1 2 3 4 5

Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.