Variables and Data types in C | part 2

@T-Bone

This section focuses on the "Variables And Datatypes" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

This section focuses on the "Variables And Datatypes" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

Questions

1. Which of the following can have different meaning in different contexts?

Mark the correct option

2. Which of the following is not a valid declaration in C? 1. short int x; 2. signed short x; 3. short x; 4. unsigned short x;

Mark the correct option

3. The minimum number of temporary variable needed to swap the content of two variables is?

Mark the correct option

4. What is short int in C programming?

Mark the correct option

5. The precedence of arithmetic operators is (from highest to lowest)?

Mark the correct option

6. Which of the following data type will throw an error on modulus operation(%)?

Mark the correct option

7. Relational operators cannot be used on:

Mark the correct option

8. What is the output of this program? #include <stdio.h> int main(){ printf("%d ",sizeof(2.5)); printf("%d ",sizeof(2)); printf("%d",sizeof('A')); return 0; }

Mark the correct option

9. What is the output of this program? #include <stdio.h> int main(){ signed a; unsigned b; a = 6u + -16 + 16u + -6; b = a + 1; if(a == b) printf("%d %d",a,b); else printf("%u %u",a, b); return 0; }

Mark the correct option

10. By default a real number is treated as a

Mark the correct option

11. What is the output of this program? int main() { char ch; ch = 128; printf("%d", ch); return 0; }

Mark the correct option

12. What is the output of this program? int main() { float x = 'a'; printf("%f", x); return 0; }

Mark the correct option

13. How would you round off a value from 6.66 to 7.0?

Mark the correct option

14. What will be the output of the program in 16 bit platform ? #include <stdio.h> int main() { extern int i; i = 20; printf("%d", sizeof(i)); return 0; }

Mark the correct option

15. What will be output when you will execute following c code? #include <stdio.h> int main() { printf("%d ",sizeof(5.5)); printf("%d ",sizeof(50000)); printf("%d",sizeof('A')); return 0; }

Mark the correct option

16. What is the output of this program? void main() { int i=0, j=1, k=2, m; m = i++ || j++ || k++; printf("%d %d %d %d", m, i, j, k); }

Mark the correct option

17. What is the output of this program? void main() { int c = - -14; printf("%d", c); }

Mark the correct option

18. What is the output of this program? void main() { int i=5; i = !i>10; printf("%d", i); }

Mark the correct option

19. The format identifier %i is also used for _____ data type?

Mark the correct option

20. Variable names beginning with underscore is not encouraged. Why?

Mark the correct option

Index of Questions