Home Tests Campus Placement

Campus Placement

Campus placement MCQ questions — Aptitude, Verbal, Reasoning, Technical.

2,162 Q 4 Subjects Any Graduate
Take Mock Test
Difficulty: All Easy Medium Hard 2111–2120 of 2,162
Advertisement
Q.2111 Medium Computer Knowledge C Programming
Which of the following correctly declares a pointer to a pointer?
A int *ptr;
B int **ptr;
C int &ptr;
D int ***ptr;
Correct Answer:  B. int **ptr;
EXPLANATION

A pointer to a pointer is declared using two asterisks (). int ptr declares a pointer that points to another pointer that points to an integer.

Take Test
Q.2112 Medium Computer Knowledge C Programming
What is the correct way to initialize an array of 5 integers with all elements as 0?
A int arr[5] = {};
B int arr[5] = {0};
C Both A and B
D int arr[5] = {0, 0, 0, 0, 0};
Correct Answer:  C. Both A and B
EXPLANATION

Both {} and {0} will initialize all array elements to 0. When you provide fewer initializers than array size, remaining elements are automatically set to 0.

Take Test
Q.2113 Medium Computer Knowledge C Programming
What will be the memory size of the following struct?
struct Point { int x; char c; int y; }
A 9 bytes
B 10 bytes
C 12 bytes
D 16 bytes
Correct Answer:  C. 12 bytes
EXPLANATION

Due to memory alignment/padding: int x (4 bytes), char c (1 byte) + 3 bytes padding, int y (4 bytes) = 12 bytes total. The compiler adds padding to align data members to their natural boundaries for efficient memory access.

Take Test
Q.2114 Easy Computer Knowledge C Programming
Which keyword is used to create a constant variable in C?
A final
B constant
C const
D static
Correct Answer:  C. const
EXPLANATION

The const keyword is used in C to declare a constant variable whose value cannot be modified after initialization. Variables declared as const are read-only.

Take Test
Q.2115 Easy Computer Knowledge C Programming
What is the purpose of the & operator in C?
A Bitwise AND operation
B Address-of operator
C Both A and B
D Logical AND operation
Correct Answer:  C. Both A and B
EXPLANATION

The & operator has two uses in C: (1) When used before a variable, it returns the memory address of that variable (address-of operator), and (2) When used between two integers, it performs a bitwise AND operation.

Take Test
Advertisement
Q.2116 Easy Computer Knowledge C Programming
Which of the following is NOT a valid C data type?
A float
B boolean
C double
D char
Correct Answer:  B. boolean
EXPLANATION

C does not have a built-in boolean data type. The other options (float, double, char) are all valid primitive data types in C. Boolean functionality is typically implemented using int (0 for false, non-zero for true).

Take Test
Q.2117 Easy Computer Knowledge C Programming
What is the size of an integer variable in most modern C compilers?
A 2 bytes
B 4 bytes
C 8 bytes
D It depends on the compiler
Correct Answer:  B. 4 bytes
EXPLANATION

On most modern 32-bit and 64-bit systems, an int is typically 4 bytes (32 bits). However, the exact size can vary depending on the compiler and system architecture.

Take Test
Q.2118 Hard Computer Knowledge C Programming
Which of the following statements about static variables is TRUE?
A Static variables are re-initialized every function call
B Static variables retain their value between function calls
C Static variables cannot be used in functions
D Static variables are automatically deallocated
Correct Answer:  B. Static variables retain their value between function calls
EXPLANATION

Static variables are initialized only once and retain their value throughout the program execution. Their value persists between function calls.

Take Test
Q.2119 Hard Computer Knowledge C Programming
What will be the result of executing: int a = 5, b = 10; int *ptr = &a; ptr = &b; printf("%d", *ptr);?
A 5
B 10
C Address of b
D Compilation error
Correct Answer:  B. 10
EXPLANATION

ptr is reassigned to point to b. When we dereference ptr using *ptr, we get the value stored at b, which is 10.

Take Test
Q.2120 Hard Computer Knowledge C Programming
What is the time complexity of searching for an element in an unsorted array using linear search?
A O(1)
B O(log n)
C O(n)
D O(n²)
Correct Answer:  C. O(n)
EXPLANATION

Linear search checks each element sequentially. In the worst case, it needs to check all n elements, resulting in O(n) time complexity.

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