C Programming
C language from basics to advanced placement prep
499 Questions 10 Topics Take Test
Advertisement
Showing 451–460 of 499 questions
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
Q.454 Medium Basics & Syntax
What is the output of this code?
#include
int main() {
int a = 5, b = 10;
a = a ^ b;
b = a ^ b;
a = a ^ b;
printf("%d %d", a, b);
return 0;
}
A 5 10
B 10 5
C 0 0
D 10 10
Correct Answer:  B. 10 5
EXPLANATION

This is a classic XOR swap algorithm. After three XOR operations, a and b exchange their values. Result: a=10, b=5.

Take Test
Q.455 Medium Basics & Syntax
What will be printed by the following code?
#include
int main() {
int arr[5] = {1, 2, 3, 4, 5};
int *p = arr;
printf("%d %d", *(p+2), arr[2]);
return 0;
}
A 3 3
B 2 4
C 4 3
D 3 4
Correct Answer:  A. 3 3
EXPLANATION

*(p+2) accesses the element at index 2 (value 3), and arr[2] also accesses index 2 (value 3). Both print 3.

Take Test
Q.456 Medium Basics & Syntax
Consider the following code:
int x = 5;
int *ptr = &x;
int **pptr = &ptr;
printf("%d", **pptr);
What is the output?
A 5
B Address of x
C Address of ptr
D Compilation Error
Correct Answer:  A. 5
EXPLANATION

pptr is a pointer to pointer. **pptr dereferences twice: first to get ptr, then to get x's value which is 5.

Take Test
Q.457 Medium Basics & Syntax
Which of the following about register variables is TRUE?
A They must be initialized
B They are faster to access than normal variables
C They cannot be pointers
D They are stored in RAM
Correct Answer:  B. They are faster to access than normal variables
EXPLANATION

register keyword suggests the compiler to store the variable in CPU register for faster access. Modern compilers often ignore this hint. You cannot take address of register variables.

Take Test
Q.458 Medium Basics & Syntax
What does the 'volatile' keyword in C indicate?
A Variable value can change unexpectedly
B Variable is constant
C Variable is local
D Variable must be initialized
Correct Answer:  A. Variable value can change unexpectedly
EXPLANATION

volatile tells the compiler that a variable's value can change unexpectedly (e.g., in hardware registers or interrupt handlers), so it should not optimize away repeated reads.

Take Test
Q.459 Medium Basics & Syntax
What is the output of: printf("%d %d", 10 % 3, 10 / 3);
A 3 3
B 1 3
C 3 1
D 10 10
Correct Answer:  B. 1 3
EXPLANATION

10 % 3 = 1 (remainder), 10 / 3 = 3 (integer division). Output is '1 3'.

Take Test
Q.460 Medium Basics & Syntax
Which of the following is correct about static variables in C?
A They are destroyed after function returns
B They retain their value between function calls
C They cannot be used in functions
D They are global by default
Correct Answer:  B. They retain their value between function calls
EXPLANATION

Static variables retain their value between function calls and are initialized only once. They persist for the lifetime of the program.

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