Home Subjects C Programming

C Programming

C language from basics to advanced placement prep

291 Q 10 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 241–250 of 291
Topics in C Programming
In C programming, which of the following is NOT a fundamental data type?
A int
B float
C string
D double
Correct Answer:  C. string
EXPLANATION

string is not a fundamental data type in C. Fundamental types are int, float, double, char, and void. Strings are arrays of characters.

Test
What is the output of: int a = 5, b = 2; printf("%d", a / b);
A 2.5
B 2
C 3
D Compilation error
Correct Answer:  B. 2
EXPLANATION

Both a and b are integers, so integer division is performed: 5/2 = 2 (remainder discarded).

Test
Which data type would be most appropriate to store a person's age in a program?
A float
B double
C int
D char
Correct Answer:  C. int
EXPLANATION

Age is an integer value. Using 'int' is appropriate and memory-efficient. Floating-point types are unnecessary for this discrete value.

Test
What is the difference between 'signed' and 'unsigned' char?
A Only storage capacity differs
B Range of values they can store differs
C Signed cannot store special characters
D Unsigned uses more memory
Correct Answer:  B. Range of values they can store differs
EXPLANATION

Signed char ranges from -128 to 127, while unsigned char ranges from 0 to 255. Both use 1 byte but interpret the bits differently.

Test
What is the size of the 'char' data type in C on most modern systems?
A 1 byte
B 2 bytes
C 4 bytes
D 8 bytes
Correct Answer:  A. 1 byte
EXPLANATION

The 'char' data type occupies 1 byte (8 bits) of memory on virtually all modern C systems, as per the C standard.

Test
What happens if you assign a double value to an int variable without casting?
A Compilation error
B The fractional part is truncated
C The value is rounded
D Runtime error
Correct Answer:  B. The fractional part is truncated
EXPLANATION

Implicit conversion truncates decimal part. int x = 3.7; results in x=3 with no error.

Test
What is the range of 'signed char' in C?
A 0 to 255
B -128 to 127
C -256 to 255
D 0 to 127
Correct Answer:  B. -128 to 127
EXPLANATION

Signed char uses 8 bits with one bit for sign, giving range -128 to 127 (2^7 to 2^7-1).

Test
What is the size of a 'float' data type in C on most 32-bit systems?
A 2 bytes
B 4 bytes
C 8 bytes
D 16 bytes
Correct Answer:  B. 4 bytes
EXPLANATION

On most 32-bit systems, float occupies 4 bytes (32 bits) of memory according to IEEE 754 standard.

Test
What is the difference between initialization and assignment in C?
A Both terms mean the same thing
B Initialization happens at declaration; assignment happens later
C Assignment happens during declaration; initialization happens later
D Initialization is for arrays; assignment is for variables
Correct Answer:  B. Initialization happens at declaration; assignment happens later
EXPLANATION

Initialization assigns a value when the variable is declared (int x = 5;). Assignment changes the value later (x = 10;).

Test
Which of the following is a storage class in C?
A primary
B secondary
C static
D dynamic
Correct Answer:  C. static
EXPLANATION

The storage classes in C are: auto, register, static, and extern. 'static' is one of them.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips