3- variables, identifiers, assignment, input/output Flashcards

1
Q

Variable

A

a named memory location

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

Variable value

A

data stored in variable
variable always has a value

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

Identifiers

A

name of a variable or any other named construct

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

Identifier naming conventions

A

identifier must start with a letter or underscore symbol (_), the rest of the characters should be letters, digits or underscores

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

Snake Case

A

terse, use abbreviations and underscores to separate the words, never use capital letters for variables

min
temperature
camera_angle
cur_point_nmbr

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

Camel Case

A

if multiple words: capitalize, do not use underscores
variant: first letter lowercased

1:
Min
Temperature
CameraAngle
CurrentNumberPoints

2:
min
temperature
cameraAngle
currentNumberPoints

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

Keywords

A

identifiers reserved as part of the language
int, return, float, double
cannot be used by the programmer to name constructs
consist of lowercase letters only
have special meaning to the compiler

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

Declaration

A

introduction of the name to the compiler
before use, every variable in C++ program needs to be declared
example declarations:
int numberOfBars;
double weight, totalWeight;

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

Type

A

the kind of data stored in a variable

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

Assignment statement

A

an order to the computer to set the value of the variable on the left-hand side of equal sign to the value of the right-hand side
example:
numberOfBars = 37;
totalWeight = oneWeight;
totalWeight = oneWeight * numberOfBars;
numberOfBars = numberOfBars + 3;

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

Stream

A

a sequence of data to be processed

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

Input stream

A

data to be input into program

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

Output stream

A

data generated by the program to be output

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

«

A

is insertion operator, it inserts data into the output stream

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

> >

A

extraction operator

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

cout

A

variable values as well as strings of text can be output to the screen using cout (Console OUTput) stream

17
Q

endl

A

tells the output from the next line

18
Q

\n

A

at the end of the string serves the same purpose as endl

19
Q

cin

A

(Console INput) – stream used to give variables user-input values
need to add the following to the beginning of your program

20
Q

Dialog

A

collection of program prompts and user responses

21
Q

Input token

A

sequence of characters separated by white space (spaces, tabs, newlines)

22
Q

\t

A

horizontal tab

23
Q

\a

A

alert

24
Q

\

A

backslash

25
Q

"

A

double quote