ExamVeda
Login
Home
11
Which operator is used to access the value stored at a pointer address in C?
Discuss
Answer & Solution
Answer: Option C
Solution:
In C, the * operator is used to access the value stored at a pointer address. It is called the "dereference" operator and is used to obtain the value that the pointer is pointing to.

Option A (&) is the address-of operator, used to obtain the memory address of a variable.
Option B (->) is used to access members of a structure or union through a pointer to that structure or union.
Option D (.) is used to access members of a structure or union directly, not through a pointer.
12
What is the result of the expression 7 / 2 in C?
Discuss
Answer & Solution
Answer: Option C
Solution:
In C, when you perform integer division, as in the expression 7 / 2, it results in the quotient without any decimal places. Therefore, the result is 3.

Option A (2) is incorrect because it doesn't consider integer division.
Option B (3.5) is incorrect because it represents the result of floating-point division.
Option D (3.50) is also incorrect because it represents a floating-point number, which is not the result of integer division.
13
What is the result of the expression 5 % 3 in C?
Discuss
Answer & Solution
Answer: Option A
Solution:
In C, the % (modulo) operator is used to calculate the remainder when one number is divided by another. In the expression 5 % 3, it calculates the remainder of dividing 5 by 3, which is 2.
14
Which operator is used for logical NOT in C?
Discuss
Answer & Solution
Answer: Option B
Solution:
In C, the ! operator is used for logical NOT. It negates the value of a Boolean expression, turning true to false and false to true.

Option A (&&) represents the logical AND operator, not logical NOT.
Option C (&) represents the bitwise AND operator, not logical NOT.
Option D (|) represents the bitwise OR operator, not logical NOT.
15
What is the result of the expression 10 / 0 in C?
Discuss
Answer & Solution
Answer: Option D
Solution:
In C, dividing a number by zero is undefined and leads to a runtime error. The expression 10 / 0 will result in a runtime error because dividing by zero is not allowed in mathematics or in C programming.

Option A (0) is incorrect because dividing by zero does not result in zero; it is undefined.
Option B (Infinity) is not the result in C programming when you divide by zero; it depends on the context and compiler.
Option C (Compilation error) typically does not occur because the error is detected at runtime, not during compilation.
16
Which operator is used for assignment in C?
Discuss
Answer & Solution
Answer: Option B
Solution:
In C, the = operator is used for assignment. It is used to assign a value to a variable or a data location.

Option A (==) represents the equality operator, used to compare two values for equality.
Option C (:=) is not a valid operator in C programming.
Option D (->) is used for accessing members of a structure or union through a pointer to that structure or union, not for assignment.
17
What is the result of the expression 3 * (4 + 2) in C?
Discuss
Answer & Solution
Answer: Option A
Solution:
> In C, arithmetic expressions follow the order of operations (PEMDAS/BODMAS), where parentheses have the highest precedence. Therefore, the expression 3 * (4 + 2) is evaluated as follows: First, the expression inside the parentheses is calculated (4 + 2), which results in 6. Then, the multiplication is performed: 3 * 6, which indeed equals 18.
18
Which operator is used to perform a bitwise AND operation in C?
Discuss
Answer & Solution
Answer: Option C
Solution:
In C, the & operator is used to perform a bitwise AND operation. It performs a bitwise AND between corresponding bits of two integers. It returns a new integer where each bit is the result of ANDing the corresponding bits of the operands.

Option A (&&) represents the logical AND operator, which is used for logical comparisons, not bitwise operations.
Option B (|) represents the bitwise OR operator, which performs bitwise OR operations, not bitwise AND.
Option D (||) represents the logical OR operator, used for logical comparisons, not bitwise operations.
19
What is the result of the expression 5 / 2 in C?
Discuss
Answer & Solution
Answer: Option A
Solution:
In C, when you perform integer division, as in the expression 5 / 2, it results in the quotient without any decimal places. Therefore, the result is 2.

Option B (2.5) is incorrect because it represents the result of floating-point division, not integer division.
Option C (2.50) is incorrect because it also represents a floating-point number, which is not the result of integer division.
Option D (3) is incorrect because it doesn't consider integer division; the correct result is 2.
20
What is the order of precedence of the logical operators in C?
Discuss
Answer & Solution
Answer: Option D
Solution:
In C, the order of precedence for logical operators is as follows: OR (||) has the highest precedence, followed by NOT (!), and then AND (&&). This order ensures that expressions are evaluated correctly based on logical conditions.

Option A (AND, OR, NOT) is incorrect because it doesn't follow the correct order of precedence.
Option B (NOT, OR, AND) is also incorrect for the same reason.
Option C (OR, AND, NOT) is incorrect as it doesn't reflect the correct order of precedence for logical operators in C.