Question:

Consider the following statements in C to write a program in their order of occurrence :
A. Printf("%d", i);

B. void main ( )

C. int i=5;

D. #include <stdio.h>

Choose the correct answer from the options given below :

Show Hint

Remember the skeleton: Include $\to$ Main $\to$ Declare $\to$ Execute. You can't use a tool (printf) without its manual (stdio.h), and you can't print a variable (i) before you create it!
Updated On: Jun 6, 2026
  • D, B, C, A
  • B, D, C, A
  • B, C, A, D
  • D, B, A, C
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

To write a functional C program, code must follow a specific structural order required by the compiler. 1. Header Files (D): The first step is always to include the necessary libraries. #include <stdio.h> is required for input/output functions like printf. 2. Main Function Entry (B): Every C program execution begins with the main() function. After the headers, we define the entry point: void main(). 3. Variable Declaration (C): Inside the function, variables must be declared before they are used. Thus, int i=5; comes before any logic that references $i$. 4. Execution/Output (A): Finally, the logic or output statement printf("%d", i); is executed to display the value. The sequence is: D $\to$ B $\to$ C $\to$ A.
Was this answer helpful?
0
0

Top CUET PG Data Science A.I Cyber Security and Computer Sci. Questions

View More Questions

Top CUET PG Programming and Data Structures Questions

View More Questions