What will be the output of the program given below?
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
What will be the output of the program given below?
#include <stdio.h>
int main()
{
char str[80] = "World Table Tennis Championship";
char t[10];
char *p, *q;
p = str;
while (*p)
{
q = t;
while (*p != ' ' && *p)
{
*q = *p;
q++;
p++;
}
if (*p) p++;
*q = '\0';
printf("%s\n", t);
}
return 0;
}
Show answer & explanation
Answer: A. A) Compile time error
Rigorous technical derivation based on engineering and aptitude principles.
Step-by-step Derivation:
Step 1: Analyze problem statement.
Step 2: Evaluate options.
Step 3: Select verified answer.