Home Tests Campus Placement

Campus Placement

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

2,162 Q 4 Subjects Any Graduate
Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 2081–2090 of 2,162
Subjects in Campus Placement
Q.2081 Easy Computer Knowledge C Programming
What is the purpose of the return statement in a C function?
A To exit the program
B To return a value to the caller and exit the function
C To declare variables
D To create a loop
Correct Answer:  B. To return a value to the caller and exit the function
EXPLANATION

The return statement is used to exit a function and return a value (if any) to the calling function. If the function has return type void, no value is returned.

Take Test
Q.2082 Easy Computer Knowledge C Programming
Which of the following is used to declare a constant in C?
A constant int x = 5;
B const int x = 5;
C final int x = 5;
D immutable int x = 5;
Correct Answer:  B. const int x = 5;
EXPLANATION

In C, the 'const' keyword is used to declare constants. Once a const variable is initialized, its value cannot be changed. Options A, C, and D are not valid C syntax.

Take Test
Q.2083 Easy Computer Knowledge C Programming
What will be the output of: int a = 10; int b = 20; int c = a + b; printf("%d", c);?
A 10
B 30
C 20
D Error
Correct Answer:  B. 30
EXPLANATION

Variable 'a' is initialized to 10, 'b' is initialized to 20. When c = a + b, c becomes 10 + 20 = 30. Therefore, printf outputs 30.

Take Test
Q.2084 Easy Computer Knowledge C Programming
In C programming, which of the following is NOT a valid data type?
A int
B float
C string
D double
Correct Answer:  C. string
EXPLANATION

In C, 'string' is not a primitive data type. C uses 'char' arrays to represent strings. The valid primitive data types are int, float, double, char, void, and their variants.

Take Test
Q.2085 Hard Computer Knowledge C Programming
In C, what is the purpose of the typedef keyword?
A Define a new data type
B Create an alias for existing data types
C Declare type of variables
D Convert one data type to another
Correct Answer:  B. Create an alias for existing data types
EXPLANATION

typedef creates an alias (synonym) for existing data types. For example, 'typedef int Integer;' creates 'Integer' as an alias for 'int'. This improves code readability and portability. It doesn't create entirely new types, but provides alternative names.

Take Test
Q.2086 Hard Computer Knowledge C Programming
Which of the following function declarations is correct for a function that takes no parameters and returns no value?
A void function(void);
B void function();
C null function(void);
D void function(null);
Correct Answer:  A. void function(void);
EXPLANATION

The correct syntax is 'void function(void);' where 'void' in parentheses explicitly states no parameters. Option B is also valid in C (defaults to no parameters), but option A is more explicit and portable across C standards.

Take Test
Q.2087 Hard Computer Knowledge C Programming
What is the difference between structure and union in C?
A Both allocate memory to all members simultaneously
B Structure allocates memory to all members; union allocates shared memory
C Union allocates memory to all members; structure allocates shared memory
D No difference
Correct Answer:  B. Structure allocates memory to all members; union allocates shared memory
EXPLANATION

Structure allocates separate memory for each member (total size = sum of all members). Union shares a single memory location among all members (total size = size of largest member). This is a fundamental difference in memory allocation.

Take Test
Q.2088 Hard Computer Knowledge C Programming
What will be the output of: int x = 5; printf("%d %d", x++, ++x);?
A 5 7
B 6 7
C 5 6
D 6 6
Correct Answer:  A. 5 7
EXPLANATION

x++ is post-increment (returns 5, then x becomes 6), ++x is pre-increment (x becomes 7, then returns 7). The order of evaluation in printf is implementation-dependent, but typically right to left, giving 5 7.

Take Test
Q.2089 Hard Computer Knowledge C Programming
Which of the following is an invalid identifier in C?
A myVar
B my_var
C my$var
D _myVar
Correct Answer:  C. my$var
EXPLANATION

In C, identifiers can only contain alphanumeric characters (a-z, A-Z, 0-9) and underscores (_), and must start with a letter or underscore. The dollar sign (\() is not allowed, making 'my\)var' invalid.

Take Test
Q.2090 Medium Computer Knowledge C Programming
What is the output of the following: int x = 5; int *p = &x; printf("%d", *p);?
A Address of x
B 5
C Garbage value
D Error
Correct Answer:  B. 5
EXPLANATION

p is a pointer to x, so &x gives the address of x. *p (dereferencing) gives the value stored at that address, which is 5. The output will be 5.

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