Data Types, Variables and If-Else: viva questions and MCQs
Computer Programming Lab (C), Unit 2. 100+ Data Types, Variables and If-Else questions with explanations (Computer Programming Lab (C)). Topics: C Datatypes, C Operators Output. Take a free test…
Topics
- C Datatypes: operator, integer, variable, floating point, precision floating, conversion, declaration, logical
- C Operators Output: printf, prints
Key terms: operator, integer, variable, floating point, precision floating, conversion, printf, prints
Sample questions with answers
In C, "ASCII value of 'A'" is:
Options: A) Logical OR, true if at least one operand is true B) Giving a variable a value at the time of declaration C) Integer type usually of 2 bytes D) 65
Answer: D) 65. ASCII value of 'A': 65.
int a = 25, b = 2; printf("%d %d", a / b, a % b); prints:
Options: A) 13 1 B) 12 1 C) 12.5 1 D) 1 12
Answer: B) 12 1. Integer division truncates; % gives the remainder.
Size of char in C is:
Options: A) 1 byte B) 2 bytes C) 4 bytes D) 8 bytes
Answer: A) 1 byte. Always 1 by definition.