C Programming
C language from basics to advanced placement prep
303 Questions 10 Topics Take Test
Advertisement
Showing 281–290 of 303 questions
Q.281 Easy Basics & Syntax
In C, what is the size of the 'char' data type?
A 1 bit
B 1 byte
C 2 bytes
D 4 bytes
Correct Answer:  B. 1 byte
EXPLANATION

By C standard, sizeof(char) is always 1 byte, regardless of platform.

Take Test
Q.282 Easy Basics & Syntax
Which of the following is NOT a valid C identifier?
A _variable123
B 123variable
C variable_123
D __var__
Correct Answer:  B. 123variable
EXPLANATION

Identifiers cannot start with a digit. They must start with a letter (a-z, A-Z) or underscore.

Take Test
Q.283 Easy Basics & Syntax
What is the size of the 'int' data type in a 32-bit system according to C standard?
A 2 bytes
B 4 bytes
C 8 bytes
D Platform dependent
Correct Answer:  D. Platform dependent
EXPLANATION

The size of 'int' is implementation-defined and depends on the compiler and platform, though it is typically 4 bytes on 32-bit systems.

Take Test
Q.284 Easy Basics & Syntax
Which escape sequence is used to print a newline character in C?
A \t
B \n
C \r
D \0
Correct Answer:  B. \n
EXPLANATION

The escape sequence \n represents a newline character that moves the cursor to the next line.

Take Test
Q.285 Easy Basics & Syntax
What is the default return type of the main() function in C?
A void
B int
C float
D char
Correct Answer:  B. int
EXPLANATION

The main() function implicitly returns int type, which indicates the program's exit status (0 for success, non-zero for failure).

Take Test
Q.286 Easy Basics & Syntax
Which of the following variable names is valid in C?
A 2variable
B var-iable
C _variable123
D var iable
Correct Answer:  C. _variable123
EXPLANATION

Variable names in C must start with a letter or underscore, followed by alphanumeric characters or underscores. '_variable123' is valid, while '2variable' starts with digit, 'var-iable' has hyphen, and 'var iable' has space.

Take Test
Q.287 Easy Basics & Syntax
What does the 'sizeof' operator return in C?
A The memory address of a variable
B The number of bytes occupied by a data type or variable
C The value of the variable
D The type of the variable
Correct Answer:  B. The number of bytes occupied by a data type or variable
EXPLANATION

The sizeof operator returns the size in bytes of a data type or the allocated memory for a variable.

Take Test
Q.288 Easy Basics & Syntax
Which header file is required to use the printf() function in C?
A #include
B #include
C #include
D #include
Correct Answer:  B. #include
EXPLANATION

The stdio.h (Standard Input Output) header file contains declarations for printf() and scanf() functions.

Take Test
Q.289 Easy Basics & Syntax
What is the size of 'char' data type in C?
A 2 bytes
B 4 bytes
C 1 byte
D 8 bytes
Correct Answer:  C. 1 byte
EXPLANATION

The 'char' data type in C occupies 1 byte of memory and can store a single character.

Take Test
Q.290 Easy Basics & Syntax
Which of the following is the correct syntax to declare a pointer to an integer in C?
A int *ptr;
B int& ptr;
C *int ptr;
D ptr *int;
Correct Answer:  A. int *ptr;
EXPLANATION

In C, a pointer to an integer is declared using 'int *ptr;' where '*' indicates pointer declaration.

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