W1: A Simple Calculation Flashcards

1
Q

How does an application work?

A

The app receives an input from the user, converts it into output, then displays it on user’s screen.
Program instructions are used to store the input data in RAM, retrieve input from RAM, convert it in the CPU, and store the result in RAM.

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

What are constant values?

A

Numbers, characters, or string literals. Each constant is of a specific type.

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

How do you define a numeric constant in hexadecimal representation?

A

Add ox in the prefix

Ex. const int x = ox5c // same as const int x =92

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

What type are all character constants? How do you define a character constant?

A

Char type. The ways of defining a character constant are:

  • the digit or letter enclosed in single quotes ( ‘1’)
  • the decimal value from the collating sequence
  • the hexadecimal value from the collating sequence
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an escape sequence?

A

A special action or symbol

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

What is a string literal?

A

A sequence of characters within a pair of double quotes.

Ex. “This is C”

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

What does the function ‘scanf’ do?

A

Accepts data from the user and stores the data in memory at the address of the specified program variable.

Ex. scanf(format,address);

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

What is a format?

A

A string literal that describes how to convert text entered by user into data stored in memory.
The format contains the conversion specifier for translating the input characters

Ex. %c = character (char)
%d = decimal (int, short)
%f = floating point (float)
%lf = floating point (double)

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

What is an address?

A

Contains the address of the variable.

Prefix ‘&’ is used to refer to the address of a variable

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

What is an operand?

A

A placeholder for the variable or constant.

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

What does the printf instruction do?

A

Prints the value or variable to the user.

Ex. printf(format, expression);

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