C Programming MCQ - Variables & Datatypes

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

A. &
B. *
C. Both A and B
D. None of the above

View Answer


22. 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;

A. 1 and 2
B. 2 and 4
C. 3 and 4
D. All are valid

View Answer


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

A. 2
B. 3
C. 0
D. 1

View Answer


24. What is short int in C programming?

A. The basic data type of C
B. Qualifier
C. Short is the qualifier and int is the basic datatype
D. All of the mentioned

View Answer


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

A. %, *, /, +, -
B. %, +, /, *, -
C. %, +, -, *, /
D. +, -, %, *, /

View Answer


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

A. int
B. char
C. float
D. long

View Answer


27. Relational operators cannot be used on:

A. String
B. float
C. long
D. structure

View Answer


28. 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;
}

A. 8 4 2
B. 4 4 1
C. 8 4 1
D. 4 4 2

View Answer


29. 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;
}

A. Compilation error
B. 1 0
C. 0 0
D. 0 1

View Answer


30. By default a real number is treated as a

A. float
B. double
C. long double
D. far double

View Answer







Also check :


Discussion


* You must be logged in to add comment.