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 261–270 of 303
Topics in C Programming
Which keyword is used to modify a variable so that it cannot be changed?
A static
B const
C register
D extern
Correct Answer:  B. const
EXPLANATION

The const keyword makes a variable read-only after initialization. Its value cannot be modified during program execution.

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

A signed char occupies 1 byte (8 bits). With sign bit, it ranges from -128 to 127 (2^7 to 2^7-1).

Take Test
How many bits are used to store a 'short int' in a standard C environment?
A 8 bits
B 16 bits
C 32 bits
D Varies by compiler
Correct Answer:  B. 16 bits
EXPLANATION

Standard C guarantees short int is at least 16 bits (2 bytes). Most systems use exactly 16 bits.

Take Test
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
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
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
Q.269 Easy Basics & Syntax
Which of the following is NOT a valid variable name in C?
A _var123
B 123var
C var_123
D __var
Correct Answer:  B. 123var
EXPLANATION

Variable names cannot start with a digit. They must start with a letter or underscore. Option B violates this rule.

Take Test
Q.270 Easy Basics & Syntax
What is the output of the following C program?
#include
int main() {
char str[] = "GATE";
printf("%d", sizeof(str));
return 0;
}
A 4
B 5
C 6
D Compilation Error
Correct Answer:  B. 5
EXPLANATION

sizeof(str) includes the null terminator. The string "GATE" has 4 characters plus 1 null terminator = 5 bytes.

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