Intro to Programming Study Guide Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

T/F C++ is an example of a high level language.

A

True

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

T/F C++ is an example of an interpreted language.

A

False

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

What are the semantics of a programming language?

A

the meaning attached to the instructions

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

What is the syntax of a programming language?

A

how instructions are written

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

What are the different types of identifiers?

A

variables and constants

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

Memory for variables is determined at _____ and the values are stored at ______.

A

compile time, run time

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

Memory for constants is determined at _____ time and the values are stored at _____.

A

compile time, compile time

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

What are the 3 differences in how we declare variables versus constants?

A

assign values to constants
declareVariables vs. DECLARE_CONSTANTS
const before declaring constants

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

When would we declare an identifier a constant?

A

when we don’t change its value, when we need to use a literal

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

What is a literal in C++

A

an actual value

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

What are the 2 things the compiler needs to know when we declare an identifier? How do we provide this information to the compiler?

A

the data type, how much memory needs to be stored

the datatype

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

What is the difference between ‘A’ and “A” in C++?

A

‘A’ - single character

“A” = C-string of 2 characters (‘A’ & ‘\0’)

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

How would we declare a c-string variable which could store a name of up to 10 characters?

A

char name[11]

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

How would we declare a constant named A which would store the single value ‘A’?

A

const char A = ‘A’

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

What data type would we use to store the average of a sum of integers?

A

float

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

What data type would we use to store a counter?

A

int

17
Q

What data type would we use to store an accumulator?

A

int or float (depending on what I am accumulating)

18
Q

What data type would we use to store a letter grade?

A

char

19
Q

Where in a C++ program do we put the declaration section?

A
Immediately following
int main()
{
20
Q

Which preprocessor directives do we need to execute the following statement:
cout &laquo_space;fixed &laquo_space;setprecision(2) &laquo_space;average;

A

iomanip
iostream
using namespace std;

21
Q

Which one do we need to use fixed?

A

include

22
Q

Why do we need to return 0 at the end of int main()?

A

let the operating system know that the program is being terminated

23
Q

What should we always do before using an accumulator? Why? If we don’t will it cause a compiler error?

A

initialize it to 0
because otherwise we will use it before assigning a value to it
no, run time error