Hh Flashcards

(14 cards)

1
Q

What is the format specifier for an integer in C?

A

%d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the format specifier for a float in C?

A

%f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the format specifier for a character in C?

A

%c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the format specifier for a string in C?

A

%s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the output of printf(“%d”, 10)?

A

10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the output of printf(“%0.2f”, 3.14)?

A

3.14

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the output of printf(“%c”, ‘A’)?

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the output of printf(“%s”, “Hello”)?

A

Hello

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of the scanf function?

A

To take input from the user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the syntax for the scanf function?

A

scanf(“format string”, &variable1, &variable2, …);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the format string in scanf specify?

A

The type of input expected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the role of the & operator in scanf?

A

To pass the variable’s address (except for strings)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Fill in the blank: The format specifier for a float is _______.

A

%f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: The scanf function can take input without the & operator for strings.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly