Basics Flashcards

1
Q

decimals in float

A

7

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

decimals in double

A

15

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

Strings are also sequences of characters but with

A

fixed length

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

char d[6] = “hello”;
string e = “developer”;
string f = “, “;
string g = “!”;
cout &laquo_space;d+f+e+g &laquo_space;endl;

A

Hello,developer!

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

list<int> numbers_list({1,10,100,1000});
can you print all together?</int>

A

No

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

list<int> numbers_list{1,10,100,1000};
numbers_list.push_front(0);
numbers_list.push_back(3000);
what is the resultant list?</int>

A

0,1,10,100,1000,3000

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

in c++, maps containt — and —- ?

A

keys, values

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

map<double, float> traj;
traj[1]=20;
traj[2]=100;
for (auto item : traj)
cout &laquo_space;item.first &laquo_space;”,” &laquo_space;item.second &laquo_space;“\n”;

A

1,20
2,100

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

what is a big advantage of using maps in c++?

A

It allows you to store two kinds of variable together

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

“cout «” is a function for printing only ….

A

characters (characters out-> cout)

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

what is the function for inputting characters

A

cin&raquo_space;

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

what is namespace in C++

A

C++ has a particular feature called namespaces. They allow us to group named entities into a single scope. That way, they will only have a meaning inside that namespace. Also, we can repeat names of variables, but always inside different namespaces.

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

what are assignment operators in c++

A

=, +=, -=, *=, =/

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

what does “touch” do in linux?

A

it creates new file or update them (time stamp)

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

what is “./” in linux

A

run a file (eg excutable) that explicitly in the current directory. It helps with running faster and with no name confusion

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

what are three elements of defining a for loop?

A

for ( init; condition; increment ) {
block_statement;
}

17
Q

which one is correct?
list (string) or list <string> or list [string]</string>

A

list <string></string>

18
Q

how to go over list item using a for lop?

A

list <float> g;
for (auto i : g) {
cout <<i;</float>