Chapter 1: Data Flashcards

1
Q

Which of the following computer scientist coined the equation, Algorithms + Data Structures = Programs?

A

Niklaus Wirth

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

Which is NOT considered a data structure?

A

All of the options are data structure of some form

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

Which is not a “primitive data type” in C++?

A

Array

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

Given the following code segment, which is consider a data item?

struct Student
{
short id;
string name;
char gender;
};
….
Student jlo;

A

id

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

Which is not a “scalar” value?

A

p = { 14, 15 }

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

include

In C++, the output of the following code is __.

using namespace std;

int main()
{
cout &laquo_space;17/32;

return 0;
}

A

0

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

Given the following sample structure named “weekday”, which can create an instance named “w3”?

struct weekday
{
int i;
string name;
};

A

weekday w3 = { 2, “Tue” };

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

Which statement about “compound data structure” is true?

A

They are created by programmers and are sometimes referred as user-defined data structure.

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

Which is not an example of linear data structure?

A

Tree

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

What does it mean for a data type to be abstract?

A

It is logical description or a specification of components of a data item

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

Which of the following is not a primitive data type in C++?

A

String

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

Which best describes a data structure?

A

A way to organize and store data in a computer so that it can be efficiently accessed and modified.

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

Which of the following is NOT a primitive data type in most common programming languages?

A

String

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

What is the size of an int data type in most C++ compilers?

A

4 bytes

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

Which statement is true about “data structure” in C++?

A

It is a way of organizing and storing data so that it can be used efficiently.

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

Which of the following is a non-linear data structure?

17
Q

Which can access a member variable named “age” of a struct named “person”?

A

Person.age

18
Q

If you have a struct named “Point” with a variable “x” as member, and you declare and instance named “p1” as shown below. How would you assign the value 5 to “x”?

Point p1;

19
Q

Which the correct way to declare a C++ struct?

A

struct Student { int age; };

20
Q

What is the keyword used to define a struct in C++?