C Programming
C language from basics to advanced placement prep
303 Questions 10 Topics Take Test
Advertisement
Showing 291–300 of 303 questions
Q.291 Easy Basics & Syntax
What is the output of the following code?
#include
int main() {
char c = 'A';
printf("%d", c);
return 0;
}
A 65
B A
C 1
D Error
Correct Answer:  A. 65
EXPLANATION

The %d format specifier prints the ASCII value of the character. 'A' has ASCII value 65.

Take Test
Q.292 Easy Basics & Syntax
What will be printed by the following code?
#include
int main() {
char str[] = "Hello";
printf("%c", str[1]);
return 0;
}
A H
B e
C l
D o
Correct Answer:  B. e
EXPLANATION

String indexing starts at 0. str[0] = 'H', str[1] = 'e'.

Take Test
Q.293 Easy Basics & Syntax
In C, which of the following statements about pointers is TRUE?
A Pointers always occupy 4 bytes of memory
B A pointer stores the memory address of a variable
C Pointers cannot be used with arrays
D Dereferencing a null pointer is safe
Correct Answer:  B. A pointer stores the memory address of a variable
EXPLANATION

A pointer stores the memory address of a variable. Pointer size depends on the system architecture, not always 4 bytes.

Take Test
Q.294 Easy Basics & Syntax
What is the output of the following code?
#include
int main() {
int arr[] = {10, 20, 30};
printf("%d", *(arr + 1));
return 0;
}
A 10
B 20
C 30
D Error
Correct Answer:  B. 20
EXPLANATION

arr + 1 points to the second element. Dereferencing with * gives the value 20.

Take Test
Q.295 Easy Basics & Syntax
Which keyword is used to create a variable that cannot be modified after initialization?
A static
B const
C volatile
D extern
Correct Answer:  B. const
EXPLANATION

The 'const' keyword creates a constant variable that cannot be modified after initialization. The compiler enforces this at compile time.

Take Test
Q.296 Easy Basics & Syntax
Which of the following is a valid variable name in C?
A 2variable
B _var123
C var-name
D var name
Correct Answer:  B. _var123
EXPLANATION

Variable names must start with a letter or underscore, not a digit. They cannot contain hyphens or spaces. _var123 is the only valid name.

Take Test
Q.297 Easy Basics & Syntax
Which escape sequence represents a tab character in C?
A \t
B \tab
C \n
D \s
Correct Answer:  A. \t
EXPLANATION

\t is the escape sequence for a tab character. \n is for newline, \s is invalid in C.

Take Test
Q.298 Easy Basics & Syntax
What is the purpose of the main() function in C?
A To declare variables
B To include header files
C Entry point of program execution
D To define functions
Correct Answer:  C. Entry point of program execution
EXPLANATION

The main() function is the entry point where program execution begins. Every C program must have a main() function.

Take Test
Q.299 Easy Basics & Syntax
What is the output of: printf("%d", 5 + 3 * 2)?
A 16
B 11
C 21
D 13
Correct Answer:  B. 11
EXPLANATION

Following operator precedence, multiplication (*) has higher precedence than addition (+). So 3*2=6, then 5+6=11.

Take Test
Q.300 Easy Basics & Syntax
What does the following code snippet output?
#include
int main() {
int x = 5;
printf("%d", x++);
return 0;
}
A 5
B 6
C undefined
D Compilation error
Correct Answer:  A. 5
EXPLANATION

x++ is post-increment. The value 5 is printed first, then x is incremented to 6.

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