OA. free
Free
Palo Alto Networks Core Computer Science Core Computer Science Medium

Question 4 Select any one of the following options

Palo Alto Networks technical mcq question, verified with a worked answer. Free to practise - no sign-up.

include

extern int x;
int main(){
do{
  do{ printf("%o",x);
  }
  while(1-2);
}
while(0);
return 0;
}
int x=8;

Select any one of the following options

Choose one option.
Show answer & explanation
Answer: A. A) 10

The %o format specifier prints the integer in octal representation. Decimal 8 in octal is 10 (1 * 8^1 + 0 * 8^0).

Step-by-step Derivation:
Step 1: x is initialized to 8.
Step 2: printf("%o", x) formats the integer x in base-8 (octal).
Step 3: 8 in octal: 8 / 8 = 1 remainder 0 => 10_8.
Step 4: The printed output begins with 10.