Home Subjects C Programming

C Programming

C language from basics to advanced placement prep

1,000 Q 10 Topics Take Test
Advertisement
Difficulty: All Easy Medium Hard 891–900 of 1,000
Topics in C Programming
Which of the following is a derived data type in C?
A int
B Array
C char
D float
Correct Answer:  B. Array
EXPLANATION

Derived data types are created from fundamental types. Arrays, pointers, structures, and unions are derived types.

Take Test
What is the output of the following code?
int x = 10;
int *p = &x;
printf("%d", *p);
A 10
B Address of x
C Garbage value
D Compilation error
Correct Answer:  A. 10
EXPLANATION

p is a pointer to x. *p dereferences the pointer, giving the value of x, which is 10.

Take Test
What is the difference between 'static' and 'extern' variables?
A static has global scope, extern has local scope
B static has file scope, extern has global scope
C No difference
D static is for functions, extern is for variables
Correct Answer:  B. static has file scope, extern has global scope
EXPLANATION

static restricts variable visibility to the current file; extern declares a variable defined elsewhere with global scope.

Take Test
Which keyword is used to declare a variable that cannot be modified?
A static
B const
C volatile
D extern
Correct Answer:  B. const
EXPLANATION

'const' keyword makes a variable constant and immutable after initialization.

Take Test
What is the range of unsigned int in a 32-bit system?
A 0 to 2^31 - 1
B 0 to 2^32 - 1
C -2^31 to 2^31 - 1
D 0 to 2^16 - 1
Correct Answer:  B. 0 to 2^32 - 1
EXPLANATION

Unsigned int uses all 32 bits for magnitude, giving range 0 to 2^32 - 1 (0 to 4,294,967,295).

Take Test
Which of the following occupies maximum memory in a 64-bit system?
A long int
B long double
C double
D unsigned long long
Correct Answer:  B. long double
EXPLANATION

In a 64-bit system, long double typically occupies 16 bytes (128 bits), which is the maximum among these options.

Take Test
What will be the output of the following code?
int x = 5;
float y = x;
printf("%f", y);
A 5.000000
B Compilation error
C 5
D Garbage value
Correct Answer:  A. 5.000000
EXPLANATION

Implicit type conversion occurs from int to float. The value 5 is converted to 5.0 and printed as 5.000000 with %f format specifier.

Take Test
Which variable declaration is correct in C?
A int 2var;
B float var-name;
C char _var123;
D double var@name;
Correct Answer:  C. char _var123;
EXPLANATION

Variable names must start with a letter or underscore, followed by letters, digits, or underscores. Option C follows this rule correctly.

Take Test
What is the size of an 'int' variable in a 32-bit system?
A 2 bytes
B 4 bytes
C 8 bytes
D Compiler dependent
Correct Answer:  B. 4 bytes
EXPLANATION

In a 32-bit system, an int is typically 4 bytes (32 bits). However, the C standard only guarantees it's at least 2 bytes, so technically it's compiler-dependent. But in practice, 4 bytes is standard.

Take Test
Which of the following is NOT a fundamental data type in C?
A int
B float
C string
D char
Correct Answer:  C. string
EXPLANATION

C has 5 fundamental data types: int, float, double, char, and void. 'string' is not a fundamental type; it's created using char arrays.

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