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 271–280 of 303
Topics in C Programming
Q.271 Easy Basics & Syntax
What is the correct way to declare a two-dimensional array of integers with 3 rows and 4 columns?
A int arr[3][4];
B int arr[4][3];
C int **arr[3][4];
D int arr(3)(4);
Correct Answer:  A. int arr[3][4];
EXPLANATION

2D array syntax is int arr[rows][columns]. So int arr[3][4] creates 3 rows and 4 columns.

Take Test
Q.272 Easy Basics & Syntax
Which of the following correctly declares a pointer to an integer?
A int *ptr;
B int& ptr;
C ptr *int;
D int ptr*;
Correct Answer:  A. int *ptr;
EXPLANATION

The correct syntax for a pointer to int is 'int *ptr;' or 'int* ptr;'. & is a C++ reference, not used in C pointers.

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

\t is the escape sequence for horizontal tab. \n is newline, \h and \s are not valid escape sequences.

Take Test
Q.274 Easy Basics & Syntax
How many bytes does a 'long long' integer occupy in C (standard 32-bit system)?
A 2 bytes
B 4 bytes
C 8 bytes
D 16 bytes
Correct Answer:  C. 8 bytes
EXPLANATION

'long long' is guaranteed to be at least 64 bits (8 bytes) as per C99 standard.

Take Test
Q.275 Easy Basics & Syntax
What will be the output of: int x = 10; printf("%d", x++);
A 10
B 11
C Undefined
D Error
Correct Answer:  A. 10
EXPLANATION

x++ is post-increment. The current value (10) is printed first, then x is incremented to 11. So output is 10.

Take Test
Q.276 Easy Basics & Syntax
Which of the following is NOT a valid C data type?
A int
B string
C double
D char
Correct Answer:  B. string
EXPLANATION

C does not have a built-in 'string' data type. Strings are arrays of characters. int, double, and char are valid primitive data types.

Take Test
Q.277 Easy Basics & Syntax
What will be the output of: printf("%d", 5 / 2);
A 2.5
B 2
C 3
D Error
Correct Answer:  B. 2
EXPLANATION

Integer division truncates the result. 5/2 = 2 (not 2.5) because both operands are integers.

Take Test
Q.278 Easy Basics & Syntax
In C, which of the following correctly declares a pointer to an integer?
A int *ptr;
B *int ptr;
C int& ptr;
D pointer int *;
Correct Answer:  A. int *ptr;
EXPLANATION

The correct syntax is 'int *ptr;' where * indicates ptr is a pointer to int.

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

malloc() and other dynamic memory allocation functions are declared in <stdlib.h>.

Take Test
Q.280 Easy Basics & Syntax
What is the output of: char c = 65; printf("%c", c);
A 65
B A
C Invalid output
D Compilation error
Correct Answer:  B. A
EXPLANATION

%c format specifier prints the character representation of ASCII value 65, which is 'A'.

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