Which of the following is a valid data type in C?
A
number B
decimal C
float D
real
Analysis & Theory
`float` is a valid data type in C for decimal (floating-point) numbers.
Which data type would you use to store a single character?
A
char B
string C
text D
character
Analysis & Theory
`char` is used to store a single character in C.
What is the size of an `int` on most 32-bit systems?
A
2 bytes B
4 bytes C
8 bytes D
1 byte
Analysis & Theory
On most 32-bit systems, an `int` is 4 bytes (32 bits).
Which of the following is used to store large floating-point numbers?
A
float B
char C
double D
int
Analysis & Theory
`double` is used for storing large or more precise floating-point numbers.
Which data type would be most appropriate to store a person's age?
A
char B
float C
int D
string
Analysis & Theory
Age is a whole number, so `int` is the most appropriate.
Which keyword defines a variable that holds true/false values in C99?
A
bool B
boolean C
truefalse D
_Bool
Analysis & Theory
`_Bool` is the standard C99 keyword for boolean values.
What is the default format specifier for a `double` in `printf()`?
A
%d B
%c C
%f D
%lf
Analysis & Theory
In `printf()`, both `float` and `double` use `%f`.
Which data type would be best to store the result of `5 / 2`?
A
int B
char C
float D
short
Analysis & Theory
To get a result like `2.5`, use `float` instead of `int`.
Which of the following is a signed integer type?
A
unsigned int B
signed int C
float D
char *
Analysis & Theory
`signed int` can represent both positive and negative integers.
What will this code print?
```c
char ch = 'A';
printf("%d", ch);
```
A
A B
65 C
Error D
char
Analysis & Theory
`%d` prints the ASCII value of `'A'`, which is `65`.