[S2-SUMMATIVE] Summative Assessment 2 - STRUCTURES REVIEWER

A visually engaging illustration that represents C++ programming concepts, specifically focusing on structures, coding, and learning. Include elements like a computer screen displaying code, books about programming, and abstract tech designs in the background.

Structures Review Quiz

Test your knowledge of structures in C++ with this comprehensive quiz designed to reinforce your understanding of fundamental concepts. Whether you're a student preparing for exams or a professional brushing up on your skills, this quiz is for you!

Topics covered include:

  • Declaring and defining structures
  • Working with structure variables
  • Functions utilizing structures
37 Questions9 MinutesCreated by CraftingCode24

How many members are in this structure?

struct Person

{

    char name[50];

    int age;

    double salary;

};

3
4
2
1
Which properly declares a variable of struct Person?
struct var;
Person;
Person var;
string Person;
Can you place an array inside a structure?
Depends on variable
No
Depends on IDE
Yes
The instance of the structure is known as:
Access operator
Members
Data
Structure variable
A keyword used to define a structure?
struct
strucs
Struct
STRUC

Complete the code below:

#include <iostream>

#include <string>

using namespace std;

struct Person

{

    string name;

    int age;

    double salary;

};

 

int main()

{

    Person s1;

    s1.name = "Ronel";

    s1.age = 35;

    ____________ = 83095.99;

    return 0;

}

Salary
s1.salary
S1.salary
s1(salary)

Check the given structure:

struct Person

{

    string name;

    int age;

    float salary;

};

The salary is :

An argument
A member
A constant
An array
If you have a structure named Person, how can you create a structure variable named s1 and s2?
Person s1, s2;
Person ;
Person {s1, s2};
Person(s1, s2);
The empty parentheses in a function means that it _______________
is a void function
is a constant
doesn't have any parameters
is an array
A structure variable can be passed to a function in a similar way as a normal argument
It depends on the data type
True
It depends on IDE
False
Two or more functions having the same name but different argument(s)
Recursion
Overloaded function
Void Function
Built in function

What is the purpose of p from the following code?--

void displayData(Person p)

{

    cout << "\nDisplaying Information." << endl;

    cout << "Name: " << p.name << endl;

    cout <<"Age: " << p.age << endl;

    cout << "Salary: " << p.salary;

}

Variable
Literal
Array
Argument
Which of the following functions does not use a return statement?
Void Function
int temp (int a)
double sales (double x, double y, double x)
int add (int x, int b)
A ________________ can be passed to a function in similar way as normal argument.
Member
Function
Array
Structure variable

In the code:

Student s;

What does the s stand for?

Literal
Data Type
Structure variable
Parameter

How many members are in this structure?

struct Person

{

    char name[50];

    int age;

    float salary;

};

3
2
4
5

What is the purpose of s from the following code?--

void displayData(Student s)

{

    cout << "\nDisplaying Information." << endl;

    cout << "Name: " << s.name << endl;

    cout <<"Age: " << s.course << endl;

}

Argument
Literal
Variable
String
What does struct Point arr[5]; do?
Initialize 5 copies of structure Point
Create a structure variable
Create an array of structure
All of the mentioned

Complete the following:

struct Person

{

    string name = "Ronel Ramos";

    int age = 34;

    ________  salary = 70514.55;

};

Int
string
boolean
double
Which of the following statements assigns a value to the age member of students?
students.age = 22;
stud.age = 25;
Students.age = 20;
age.student = 22;
Which of the following statements assigns a value to the hourlyWage member of the employee?
employee.hourlyWage = 75.00;
employee->hourlyWage = 50.00;
employee:hourlyWage = 7.50;
hourlyWage.employee = 29.75;

Complete the code below:

#include <iostream>

#include <string>

using namespace std;

struct Person

{

    string name;

    int age;

};

int main()

{

    Person student;

    student.name = "Ronel";

    cout << _________________;

    return 0;

}

student:Name
student.name
students,name
Person.name
It is a collection of variables of different data types under a single name
Identifier
Array
String
Structure
Can a structure contain an integer, string and double data type?
No
Based on IDE
Based on compiler
Yes
It is a block of code to perform a specific task
Function
Parameter
Array
Constant

What is the output of the program?

int main()

{

structure hotel

{   int items;

char name[10];

}

a;

strcpy(a.name, "Neji");

a.items=10;

cout << a.name;

return 0;

}

10
Error
0
Neji
The function body is written inside ___________.
{}
<>
[]
//
Which of the following is the correct declaration of a structure variable?
Student (s1,s2);
Student s1,s2;
s1,s2= Student ;
Student s1:s2;
What is a "structure" in C++?
Elements of a structure are called members.
A structure is a collection of elements that can be of different data type
A structure is a collection of elements that can be of same data type.
All the above

Check on the given structure:

struct Person

{

    char name[50];

    int age;

    float salary;

};

If you will create an instance of the structure named p1, what would be the command?

Person = p1;
Person p1;
Person(p1)
Person P;
Which of the following is the correct declaration of a structure variable?
Person “p,q”;
Person p,q;
Person

;

Person (p,q);
Which of the following accesses a variable in structure b?
b>var;
b-var
b-> var;
b.var;
You need to create an array from a structure named Students, which is correct?
Students stud[3];
Students(3);
Students.stud = 3;
students stud -> 3;
The data elements in the structure are also known as what?
Data
objects and data
members
objects

What is the output of the following program?

#include <iostream>

using namespace std;

struct ship

{

    int size;

} boat1, boat2;

int main()

{

    boat1.size = 10;

    boat2.size = 50;

    boat2.size += boat1.size;

    cout<< boat2.size;

    return 0;

}

60
0
10
50
It is simply a function that doesn't need to return anything
Parameter
Built-in function
Void Function
Recursion

What is the output of the following program?

#include <iostream>

using namespace std;

struct ship

{

    int size;

} boat1, boat2;

int main()

{

    boat1.size = 10;

    boat2.size = boat1.size;

    cout<< boat2.size;

    return 0;

}

10
0
Error
Null
{"name":"[S2-SUMMATIVE] Summative Assessment 2 - STRUCTURES REVIEWER", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of structures in C++ with this comprehensive quiz designed to reinforce your understanding of fundamental concepts. Whether you're a student preparing for exams or a professional brushing up on your skills, this quiz is for you!Topics covered include:Declaring and defining structuresWorking with structure variablesFunctions utilizing structures","img":"https:/images/course7.png"}
Powered by: Quiz Maker