Chapter 1: Data Flashcards
Which of the following computer scientist coined the equation, Algorithms + Data Structures = Programs?
Niklaus Wirth
Which is NOT considered a data structure?
All of the options are data structure of some form
Which is not a “primitive data type” in C++?
Array
Given the following code segment, which is consider a data item?
struct Student
{
short id;
string name;
char gender;
};
….
Student jlo;
id
Which is not a “scalar” value?
p = { 14, 15 }
include
In C++, the output of the following code is __.
using namespace std;
int main()
{
cout «_space;17/32;
return 0;
}
0
Given the following sample structure named “weekday”, which can create an instance named “w3”?
struct weekday
{
int i;
string name;
};
weekday w3 = { 2, “Tue” };
Which statement about “compound data structure” is true?
They are created by programmers and are sometimes referred as user-defined data structure.
Which is not an example of linear data structure?
Tree
What does it mean for a data type to be abstract?
It is logical description or a specification of components of a data item
Which of the following is not a primitive data type in C++?
String
Which best describes a data structure?
A way to organize and store data in a computer so that it can be efficiently accessed and modified.
Which of the following is NOT a primitive data type in most common programming languages?
String
What is the size of an int data type in most C++ compilers?
4 bytes
Which statement is true about “data structure” in C++?
It is a way of organizing and storing data so that it can be used efficiently.
Which of the following is a non-linear data structure?
Graph
Which can access a member variable named “age” of a struct named “person”?
Person.age
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;
p1.x = 5;
Which the correct way to declare a C++ struct?
struct Student { int age; };
What is the keyword used to define a struct in C++?
struct