Home Subjects C Programming

C Programming

C language from basics to advanced placement prep

303 Q 10 Topics Take Test
Advertisement
Difficulty: All Easy Medium Hard 251–260 of 303
Topics in C Programming
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.

Take 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;).

Take 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.

Take Test
What is the scope of a variable declared inside a function block?
A Global scope
B File scope
C Block scope (local)
D Function scope
Correct Answer:  C. Block scope (local)
EXPLANATION

Variables declared inside a block (including function blocks) have block scope and are accessible only within that block.

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

unsigned char is 1 byte (8 bits) without sign bit, giving range 0 to 2^8-1 = 0 to 255.

Take Test
What will be the output of: printf("%d", 5/2)?
A 2.5
B 2
C 3
D Compiler error
Correct Answer:  B. 2
EXPLANATION

Integer division in C truncates the decimal part. 5/2 = 2 (not 2.5). The %d format specifier expects an integer.

Take Test
What is the default data type of a floating-point constant in C?
A float
B double
C long double
D It depends on the compiler
Correct Answer:  B. double
EXPLANATION

In C, floating-point constants like 3.14 are treated as double by default. To specify float, you need to use 3.14f suffix.

Take Test
What will be the result of sizeof(int) on a typical 32-bit system?
A 2 bytes
B 4 bytes
C 8 bytes
D Undefined
Correct Answer:  B. 4 bytes
EXPLANATION

On 32-bit systems, int is typically 4 bytes (32 bits). However, the exact size is implementation-defined per C standard.

Take Test
Which of the following variable names is INVALID in C?
A _myVar
B myVar123
C 123myVar
D my_Var
Correct Answer:  C. 123myVar
EXPLANATION

Variable names cannot start with a digit in C. Valid names must begin with a letter (a-z, A-Z) or underscore (_).

Take Test
What is the size of the double data type in most 64-bit systems?
A 4 bytes
B 8 bytes
C 16 bytes
D Compiler dependent, no fixed size
Correct Answer:  B. 8 bytes
EXPLANATION

In standard C on 64-bit systems, double occupies 8 bytes and can store values with approximately 15-17 significant digits.

Take Test
IGET
iget AI
Online · Ask anything about exams
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