Question 69

Computer Awareness Data Structure Medium

What is the output of this C code? \[\]void main() { \[\]int x = 18; \[\]void *ptr = &x; \[\]printf("%f\n", *(float *)ptr);

(A) compile time error
(B) undefined behaviour
(C) 10
(D) 0.000000\[\]
✓ Correct Answer: Option B Verified Solution

📘 Step-by-Step Solution & Detailed Explanation:

This is because dereferencing a cast pointer from an integer to a float introduces undefined behaviour. \[\] Correct Answer: (b)

Practice Similar Data Structure Questions

Reinforce your conceptual grasp with related questions from CUET-MCA 2021:

Q35 Which of the following standard algorithms is not a greedy algorithm?
Solve →
Q54 Which of these operators is used to allocate memory to array variable in...
Solve →
Q56 Consider the following function implemented in C \[\] void test fun(int x,...
Solve →
Q66 What happens if the following program is executed in C and C++? \[\]int...
Solve →
Q73 The minimum number of functions should be present in a ( C++ ) program for...
Solve →
Full-Length Test Series

Prepare for CUET-MCA Under Real Exam Conditions

Take timed full-length mock tests with authentic question distributions, negative marking (+12/-3 in Math), and instant All India Rank calculation.

Start Free Mock Test Series →