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 811–820 of 1,000
Topics in C Programming
What is the size of a 'long long int' variable in C on a 64-bit system?
A 4 bytes
B 8 bytes
C 16 bytes
D Compiler dependent
Correct Answer:  B. 8 bytes
EXPLANATION

A 'long long int' is guaranteed to be at least 64 bits (8 bytes) by the C99 standard on all systems including 64-bit architectures.

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

Take Test
Which of the following is a valid declaration of a constant array?
A const int arr[5] = {1,2,3,4,5};
B int const arr[5];
C const int arr[];
D Both A and B
Correct Answer:  D. Both A and B
EXPLANATION

Both declarations make the array elements constant. Option A initializes the array, while B declares it without initialization (valid at global scope).

Take Test
What happens in this code: int arr[5]; int *p = &arr[0]; printf("%d", sizeof(p));
A 20 (5 integers)
B 4 or 8 (pointer size)
C 5
D Compilation error
Correct Answer:  B. 4 or 8 (pointer size)
EXPLANATION

p is a pointer variable, so sizeof(p) returns the size of the pointer itself (4 bytes on 32-bit, 8 bytes on 64-bit systems), not the array.

Take Test
What is the primary purpose of the 'restrict' keyword introduced in C99?
A Restrict variable scope
B Allow compiler optimizations by promising pointer exclusivity
C Make variables read-only
D Reduce memory allocation
Correct Answer:  B. Allow compiler optimizations by promising pointer exclusivity
EXPLANATION

The 'restrict' qualifier tells the compiler that a pointer is the only way to access that object, enabling optimizations.

Take Test
What is the range of values for a signed short int?
A -128 to 127
B -32768 to 32767
C -2147483648 to 2147483647
D 0 to 65535
Correct Answer:  B. -32768 to 32767
EXPLANATION

Signed short int is typically 2 bytes (16 bits), providing a range from -2^15 to 2^15-1.

Take Test
Which of these correctly represents a floating-point literal with exponent notation?
A 1.5e2
B 1.5e
C 1e2.5
D e1.5
Correct Answer:  A. 1.5e2
EXPLANATION

Correct exponent notation requires a digit before and after 'e'. 1.5e2 represents 1.5 × 10² = 150.0

Take Test
What will be the output: const int x = 10; x = 20; printf("%d", x);
A 10
B 20
C Compilation error
D Runtime error
Correct Answer:  C. Compilation error
EXPLANATION

const variables cannot be modified after initialization. Attempting to assign a new value causes a compilation error.

Take Test
Which storage class specifier limits a variable's scope to the current file?
A extern
B static
C register
D auto
Correct Answer:  B. static
EXPLANATION

The 'static' keyword, when used at file scope, restricts the variable's visibility to that file only (internal linkage).

Take Test
What happens when you declare a variable without initializing it in C?
A It automatically gets value 0
B It contains garbage value
C Compilation error occurs
D It remains undefined until assigned
Correct Answer:  B. It contains garbage value
EXPLANATION

Uninitialized local variables contain garbage values (whatever was in memory). Only static/global variables are zero-initialized.

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