C/C /C%20Programming%20-%20MCQ%20Questions%20Set%202 Sample Test,Sample questions

Question:
Array sizes are optional during array declaration by using ______ keyword.

1.auto

2.static

3.extern

4.register

Posted Date:-2021-02-21 04:39:28


Question:
Associativity of an operator is _______

1.Right to Left

2. Left to Right

3.Random fashion

4.Both Right to Left and Left to Right

Posted Date:-2021-02-21 04:39:28


Question:
Automatic variables are allocated memory in ____

1. heap

2.Data segment

3.Code segment

4.stack

Posted Date:-2021-02-21 04:39:28


Question:
Automatic variables are initialized to __

1.Zero

2. Junk value

3.Nothing

4.Both Zero & Junk value

Posted Date:-2021-02-21 04:39:28


Question:
Automatic variables are _________

1.Declared within the scope of a block, usually a function

2. Declared outside all functions

3.Declared with the auto keyword

4.Declared within the keyword extern

Posted Date:-2021-02-21 04:39:28


Question:
 What is the default return type if it is not specified in function definition?

1.void

2. int

3.double

4.short int

Posted Date:-2021-02-21 04:39:28


Question:
Can we use a function as a parameter of another function? [Eg: void wow(int func())].

1.Yes, and we can use the function value conveniently

2.Yes, but we call the function again to get the value, not as convenient as in using variable

3.No, C does not support it

4.This case is compiler dependent

Posted Date:-2021-02-21 04:39:28


Question:
Comment on the following statement.  n = 1;printf("%d, %dn", 3*n, n++);

1.Output will be 3, 2

2.Output will be 3, 1

3.Output will be 6, 1

4.Output is compiler dependent

Posted Date:-2021-02-21 04:39:28


Question:
Functions can return enumeration constants in C?

1.TRUE

2. false

3.depends on the compiler

4.depends on the standard

Posted Date:-2021-02-21 04:39:28


Question:
Functions can return structure in C?

1.TRUE

2.FALSE

3.Depends on the compiler

4.Depends on the standard

Posted Date:-2021-02-21 04:39:28


Question:
Functions in C are always _____

1.Internal

2. External

3.Both Internal and External

4.External and Internal are not valid terms for functions

Posted Date:-2021-02-21 04:39:28


Question:
Global variables are _______

1.Internal

2.External

3.Both Internal and External

4.None of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
In expression i = g() + f(), first function called depends on ______

1.Compiler

2.Associativiy of () operator

3.Precedence of () and + operator

4. Left to write of the expression

Posted Date:-2021-02-21 04:39:28


Question:
In expression i = g() + f(), first function called depends on _________

1.Compiler

2.Associativiy of () operator

3.Precedence of () and + operator

4.Left to write of the expression

Posted Date:-2021-02-21 04:39:28


Question:
What will be the value of the following assignment expression?  (x = foo())!= 1 considering foo() returns 2

1.2

2. True

3.1

4.0

Posted Date:-2021-02-21 04:39:28


Question:
Operation “a = a * b + a” can also be written as ___________

1.a *= b + 1;

2.(c = a * b)!=(a = c + a);

3.a = (b + 1)* a;

4.All of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Register variables reside in ________

1.stack

2.registers

3.heap

4.main memory

Posted Date:-2021-02-21 04:39:28


Question:
The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ______

1.break

2.exit(0)

3.abort()

4. terminate

Posted Date:-2021-02-21 04:39:28


Question:
The keyword ‘break’ cannot be simply used within ______

1.do-while

2.if-else

3.for

4. while

Posted Date:-2021-02-21 04:39:28


Question:
The value obtained in the function is given back to main by using ________ keyword.

1.return

2.static

3.new

4.volatile

Posted Date:-2021-02-21 04:39:28


Question:
What is the return-type of the function sqrt()?

1.int

2.float

3.double

4.depends on the data type of the parameter

Posted Date:-2021-02-21 04:39:28


Question:
What is the scope of an automatic variable?

1.Exist only within that scope in which it is declared

2.Cease to exist after the block is exited

3.Exist only within that scope in which it is declared & exist after the block is exited

4.All of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
What will be the final value of c in the following C statement? (Initial value: c = 2)   c <<= 1;

1.c = 1;

2.c = 2;

3.c = 3;

4.c = 4;

Posted Date:-2021-02-21 04:39:28


Question:
When compiler accepts the request to use the variable as a register?

1.It is stored in CPU

2.It is stored in cache memory

3.It is stored in main memory

4.It is stored in secondary memory

Posted Date:-2021-02-21 04:39:28


Question:
Where in C the order of precedence of operators do not exist?

1.Within conditional statements, if, else

2.Within while, do-while

3. Within a macro definition

4. None of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which among the following is the correct syntax to declare a static variable register?

1.static register a;

2. register static a;

3.Both static register a; and register static a;

4.We cannot use static and register together

Posted Date:-2021-02-21 04:39:28


Question:
Which data type can be stored in register?

1.int

2.long

3. float

4.all of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?

1.for (i = n; i>0; i–)

2.for (i = n; i >= 0; i–)

3. for (i = n-1; i>0; i–)

4.for (i = n-1; i>-1; i–)

Posted Date:-2021-02-21 04:39:28


Question:
Which function in the following expression will be called first?  a = func3(6) - func2(4, 5) / func1(1, 2, 3);

1.func1();

2. func2();

3. func3();

4.Cannot be predicted

Posted Date:-2021-02-21 04:39:28


Question:
Which keyword can be used for coming out of recursion?

1.break

2. return

3.exit

4.both break and return

Posted Date:-2021-02-21 04:39:28


Question:
Which keyword is used to come out of a loop only for that iteration?

1.break

2.continue

3.return

4.none of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of following is not accepted in C?

1.static a = 10; //static as

2.static int func (int); //parameter as static

3.static static int a; //a static variable prefixed with static

4.all of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following are unary operators?

1.sizeof

2. –

3.++

4.all of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following cannot be static in C?

1.Variables

2.Functions

3.Structures

4.None of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?

1.variable

2.function

3.typedef

4.macros

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following function declaration is illegal?

1.int 1bhk(int);

2. int 1bhk(int a);

3.int 2bhk(int*, int []);

4. all of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is a correct format for declaration of function?

1. return-type function-name(argument type);

2.return-type function-name(argument type){}

3.return-type (argument type)function-name;

4.all of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is a ternary operator?

1.&&

2.>>=

3.?:

4.->

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is an invalid assignment operator?

1.a %= 10;

2.a /= 10;

3.a |= 10;

4.None of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is an invalid if-else statement?

1.if (if (a == 1)){}

2. if (func1 (a)){}

3.if (a){}

4.if ((char) a){}

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is NOT possible with any 2 operators in C?

1.Different precedence, same associativity

2.Different precedence, different associativity

3.Same precedence, different associativity

4.All of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is possible with any 2 operators in C?

1.Same associativity, different precedence

2.Same associativity, same precedence

3.Different associativity, different precedence

4.All of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following is the correct order of evaluation for the given expression?  a = w % x / y * z;

1. % / * =

2. / * % =

3. = % * /

4. * % / =

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following method is accepted for assignment?

1.5 = a = b = c = d;

2.a = b = c = d = 5;

3.a = b = 5 = c = d;

4.None of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following operation is not possible in a register variable?

1.Reading the value into a register variable

2.Copy the value from a memory variable

3.Global declaration of register variable

4.All of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following operator has the highest precedence in the following?

1.()

2.sizeof

3.*

4.+

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following operators has an associativity from Right to Left?

1.<=

2. <<

3.==

4.+=

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following option is the correct representation of the following C statement? e = a * b + c / d * f;

1.e = (a * (b +(c /(d * f))));

2. e = ((a * b) + (c / (d * f)));

3.e = ((a * b) + ((c / d)* f));

4.Both e = ((a * b) + (c / (d * f))); and e = ((a * b) + ((c / d)* f));

Posted Date:-2021-02-21 04:39:28


Question:
Which of the following storage class supports char data type?

1.register

2.static

3.auto

4.all of the mentioned

Posted Date:-2021-02-21 04:39:28


Question:
Which operators of the following have same precedence?   P. "!=", Q. "+=", R. "<<="

1.P and Q

2.Q and R

3.P and R

4.P, Q and R

Posted Date:-2021-02-21 04:39:28


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers OOPs Basic Concepts
  27. C++ Questions and Answers Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
  39. CPP Programming MCQ Set 1
  40. CPP Programming MCQ Set 2
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!