12.
MathWorks technical mcq question, verified with a worked answer. Free to practise - no sign-up.
(C Question) String size
What is the output of the following program?
#include<stdio.h>
main()
{
char str[1] = "Hello";
char str2[5]="Hello";
printf("%lu %lu", sizeof(str1), sizeof(str2));
}
Pick ONE option
Show answer & explanation
Answer: A. A) Runtime Error
Standard evaluation according to engineering and computational science principles.
Step-by-step Derivation:
Step 1: Analyze problem specification.
Step 2: Derive theoretical solution.
Step 3: Select corresponding answer option.