Home
Explore
Exams
Search for anything
Login
Get started
Home
[CP 2] M4 - Structures
[CP 2] M4 - Structures
0.0
(0)
Rate it
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Card Sorting
1/64
Earn XP
Description and Tags
University/Undergrad
Add tags
Study Analytics
All
Learn
Practice Test
Matching
Spaced Repetition
Name
Mastery
Learn
Test
Matching
Spaced
No study sessions yet.
65 Terms
View all (65)
Star these 65
1
New cards
char str[80];
Which of the following is correct?
Group of answer choices
char str[80];
char (80);
ch str[80];
char 80;
2
New cards
string
It is a sequence of characters
3
New cards
getline()
It is a sequence of characters
4
New cards
isspace()
Returns true provided character expression is a whitespace character, such as the blank or newline character, otherwise, returns false.
5
New cards
cin.getline(str,80);
Which of the following is correct?
Group of answer choices
Cin.getline(str,80);
cin.getlines(str,80);
cin.Getline(str,90)
cin.getline(str,80);
6
New cards
! is a punctuation character
What is the output of the given program?
\#include
7
New cards
toupper()
Converts lowercase letter to uppercase
8
New cards
concatenation
It refers to merging of two strings
9
New cards
isupper()
Returns true provided character expression is an uppercase letter otherwise it returns false
10
New cards
+
Which of the following operator can be used also in strings?
\-
\>
+
@
11
New cards
Hello World
What is the output of the following program?
\#include
12
New cards
error
What is the output of the following program?
\#include
13
New cards
stod
Which of the following function converts a string to double?
Group of answer choices
stof
stoll
stod
stoi
14
New cards
\#\=
Which of the following operators is not a comparison operator?
Group of answer choices
\>\=
\==
15
New cards
string
A header file that handles string in C++
16
New cards
char
Strings are accessed by variables of what type?
17
New cards
NOT Equal
What is the output of the following?
\#include
18
New cards
string
What is the identifier given to string class to declare string objects?
19
New cards
to_string
Which of the following function converts a numerical value to string?
tolower
stoi
toupper
to_string
20
New cards
dot . operator
What operator is used to access the members of a structure?
21
New cards
student.name
Complete the code below:
\#include
22
New cards
You need to create an array from a structure named Students, which is correct?
You need to create an array from a structure named Students, which is correct?
Students stud[3];
Students.stud \= 3;
Students(3);
students stud -\> 3;
23
New cards
yes
Can a structure contain an integer, string and double data type?
24
New cards
struct a_struct {int a;};
Which of the following is a properly defined struct?
struct a_struct {int a;};
struct a_struct int a;
struct {int a;}
struct a_struct {int a;}
25
New cards
;
\What will be used when terminating a structure?
;
;;
}
:
26
New cards
3
How many members are in this structure?
struct Person
{
char name[50];
int age;
double salary;
};
27
New cards
students.age \= 22;
Which of the following statements assigns a value to the age member of students?
Group of answer choices
stud.age \= 25;
age.student \= 22;
students.age \= 22;
Students.age \= 20;
28
New cards
Person var;
Which properly declares a variable of struct Person?
Group of answer choices
string Person;
Person var;
struct var;
Person;
29
New cards
s1.salary
Complete the code below:
\#include
30
New cards
error
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;
}
31
New cards
Student s1,s2;
Which of the following is the correct declaration of a structure variable?
Student s1:s2;
Student s1,s2;
s1,s2\= Student ;
Student (s1,s2);
32
New cards
{}
The function body is written inside \___________
33
New cards
Function
It is a block of code to perform a specific task
34
New cards
3
How many members are in this structure?
struct Person
{
char name[50];
int age;
float salary;
};
35
New cards
structure vARIABLE
A \________________ can be passed to a function in similar way as normal argument.
36
New cards
void funtion
It is simply a function that doesn't need to return anything
37
New cards
doesn't have any parameters
The empty parentheses in a function means that it \_______________
38
New cards
overloaded function
Two or more functions having the same name but different argument(s)
39
New cards
argument
What is the purpose of p from the following code?
void displayData(Person p)
{
cout << "\nDisplaying Information." << endl;
cout << "Name: " << p.name << endl;
cout <
40
New cards
ctype.h
This header declares a set of functions to classify and transform individual characters.
41
New cards
TEST STRING.
What is the output of the given program?
\#include
42
New cards
9 1 4
\#include
43
New cards
tolower()
It returns the lowercase version of a character expression:
44
New cards
strcpy()
Which of the following is a cstring function?
Group of answer choices
fabs()
sqrt()
abs()
strcpy()
45
New cards
HELLO WORLD!
What is the output of the given program?
\#include
46
New cards
strlen()
It returns the length of a string
47
New cards
iscntrl()
Check if a character is a control character
48
New cards
both append and operator +\=
Which method do we use to append more than one character at a time?
data
operator +\=
both append and operator +\=
append
49
New cards
1
What is the output of the given program?
\#include
50
New cards
word is found at index 10
What is the output of the given program?
\#include
51
New cards
H
What is the output of the following program?
\#include
52
New cards
Hello World
What is the output of the following program?
\#include
53
New cards
5
What is the output of the following program?
\#include
54
New cards
A member
Check the given structure:
struct Person
{
string name;
int age;
float salary;
};
The salary is :
55
New cards
structure
It is a collection of variables of different data types under a single name
56
New cards
Person s1, s2;
If you have a structure named Person, how can you create a structure variable named s1 and s2?
57
New cards
yes
Can you place an array inside a structure?
58
New cards
Person p1;
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?
59
New cards
Structure variable
\The instance of the structure is known as:
60
New cards
true
A structure variable can be passed to a function in a similar way as a normal argument
61
New cards
Person p,q;
Which of the following is the correct declaration of a structure variable?
Group of answer choices
Person p,q;
Person
62
New cards
60
What is the output of the following program?
\#include
63
New cards
void function
Which of the following functions does not use a return statement?
Group of answer choices
int temp (int a)
Void Function
double sales (double x, double y, double x)
int add (int x, int b)
64
New cards
create an array of structure
What does struct Point arr[5]; do?
65
New cards
variable
What is the purpose of s from the following code?
void displayData(Student s)
{
cout << "\nDisplaying Information." << endl;
cout << "Name: " << s.name << endl;
cout <