Coding - practical 1 Flashcards

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

What should comments be used for?

A

To explain what’s going on and to make the code easier to understand and read.

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

What should you use // for?

A

Use // for writing single line comments.

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

What should you use /**/ for?

A

Use /* */ for writing comments across multiple lines

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

What are quotation marks (‘’ ‘’) used for?

A

Quotation marks (“ “) are used to include files that we write ourselves.

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

What are triangle brackets (< >) used for?

A

Triangle brackets (< >) are used to include C++ library files.

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

What is the run function?

A

The run function is where your code gets executed.

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

What do you use when you want to print text?

A

The std::cout stream

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

What are &laquo_space;used for in the std::cout stream?

A

The two triangles arranged like this are used to insert data, i.e. we are inserting the text we want to print to the STandarD C++ OUTtput.

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

Why can we write std::cout?

A

We can write std::cout because the header file was included, which is where std::cout is declared.

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

What does the ; do?

A

Terminates a C++ statement

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

What does aserveOscillator() do?

A

aserveOscillator() switches on an oscillator with the settings that are specified as its four
arguments.

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

What are the 4 arguments inside aserveOscillator(a,b,c,d);?

A
a = oscillator number (0 – 23)
b = oscillator frequency (0.0 - 20000.0)
c = oscillator amplitude (0.0 - 1.0)
d = oscillator wave form (0 – 5)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the oscillator function call followed by?

A

A call to aserveSleep(), which causes the program execution to pause for the time specified in milliseconds (i.e. aserveSleep(1000); pauses the program for 1 second).

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