C Programming
C language from basics to advanced placement prep
499 Questions 10 Topics Take Test
Advertisement
Showing 491–499 of 499 questions
Q.491 Medium Basics & Syntax
What is the output of: printf("%f", 7/2);
A 3.5
B 3.0
C 3
D undefined
Correct Answer:  B. 3.0
EXPLANATION

7/2 performs integer division resulting in 3. Using %f format specifier prints it as 3.0 (or similar float representation).

Take Test
Q.492 Medium Basics & Syntax
What is the scope of a variable declared inside a function in C?
A Global scope
B File scope
C Function scope (local)
D Extern scope
Correct Answer:  C. Function scope (local)
EXPLANATION

Variables declared inside a function have local scope and are only accessible within that function.

Take Test
Q.493 Medium Basics & Syntax
Which of the following correctly represents a character constant in C?
A "A"
B 'A'
C A
D 'AB'
Correct Answer:  B. 'A'
EXPLANATION

Character constants in C use single quotes ('A'). Double quotes ("") are for string literals. A single character in double quotes is a string, not a character constant.

Take Test
Q.494 Medium Basics & Syntax
What will happen if we try to modify a const variable in C?
A Runtime error
B Compilation error
C It will modify successfully
D No error, but warning
Correct Answer:  B. Compilation error
EXPLANATION

Attempting to modify a const variable results in a compilation error as const variables are read-only.

Take Test
Q.495 Medium Basics & Syntax
What is the difference between declaration and definition in C?
A They are the same thing
B Declaration introduces a name; definition allocates memory
C Declaration allocates memory; definition introduces a name
D No difference in C
Correct Answer:  B. Declaration introduces a name; definition allocates memory
EXPLANATION

Declaration tells the compiler about a variable's existence (e.g., 'extern int x;'). Definition allocates actual memory (e.g., 'int x = 5;').

Take Test
Advertisement
Q.496 Medium Basics & Syntax
Consider: void func(int *p); Which statement is correct about this function declaration?
A func takes an integer as parameter
B func takes a pointer to integer as parameter
C func returns a pointer
D func cannot be called
Correct Answer:  B. func takes a pointer to integer as parameter
EXPLANATION

The * in the parameter declaration indicates that func takes a pointer to an integer, not an integer value.

Take Test
Q.497 Medium Basics & Syntax
What is the return type of strlen() function?
A int
B char
C size_t
D float
Correct Answer:  C. size_t
EXPLANATION

strlen() returns size_t, which is an unsigned integer type used for sizes and counts.

Take Test
Q.498 Medium Basics & Syntax
Which of the following is the correct way to define a constant in C?
A #define PI 3.14
B const float PI = 3.14;
C Both A and B are correct
D Neither A nor B is correct
Correct Answer:  C. Both A and B are correct
EXPLANATION

Both #define and const can be used to define constants in C. #define is a preprocessor directive, while const is a type qualifier.

Take Test
Q.499 Medium Basics & Syntax
Which of the following is NOT a valid C keyword?
A extern
B volatile
C mutable
D register
Correct Answer:  C. mutable
EXPLANATION

mutable is a C++ keyword, not a C keyword. extern, volatile, and register are valid C keywords.

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