[CP 2] M4 - Structures

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 64

flashcard set

Earn XP

Description and Tags

65 Terms

1

char str[80];

Which of the following is correct? Group of answer choices

char str[80];

char (80);

ch str[80];

char 80;

New cards
2

string

It is a sequence of characters

New cards
3

getline()

It is a sequence of characters

New cards
4

isspace()

Returns true provided character expression is a whitespace character, such as the blank or newline character, otherwise, returns false.

New cards
5

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);

New cards
6

! is a punctuation character

What is the output of the given program?

\#include
New cards
7

toupper()

Converts lowercase letter to uppercase

New cards
8

concatenation

It refers to merging of two strings

New cards
9

isupper()

Returns true provided character expression is an uppercase letter otherwise it returns false

New cards
10

Which of the following operator can be used also in strings?

-

>

@

New cards
11

Hello World

What is the output of the following program?

\#include
New cards
12

error

What is the output of the following program?

\#include
New cards
13

stod

Which of the following function converts a string to double? Group of answer choices

stof

stoll

stod

stoi

New cards
14

#=

Which of the following operators is not a comparison operator? Group of answer choices

>=

==

<=

#=

New cards
15

string

A header file that handles string in C++

New cards
16

char

Strings are accessed by variables of what type?

New cards
17

NOT Equal

What is the output of the following?

\#include
New cards
18

string

What is the identifier given to string class to declare string objects?

New cards
19

to_string

Which of the following function converts a numerical value to string?

tolower

stoi

toupper

to_string

New cards
20

dot . operator

What operator is used to access the members of a structure?

New cards
21

student.name

Complete the code below:

\#include
New cards
22

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;

New cards
23

yes

Can a structure contain an integer, string and double data type?

New cards
24

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;}

New cards
25

;

\What will be used when terminating a structure?

;

;;

}

:

New cards
26

3

How many members are in this structure?

struct Person

{

char name[50];

int age;

double salary;

};

New cards
27

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;

New cards
28

Person var;

Which properly declares a variable of struct Person? Group of answer choices

string Person;

Person var;

struct var;

Person;

New cards
29

s1.salary

Complete the code below:

\#include
New cards
30

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;

}

New cards
31

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);

New cards
32

{}

The function body is written inside ___________

New cards
33

Function

It is a block of code to perform a specific task

New cards
34

3

How many members are in this structure?

struct Person

{

char name[50];

int age;

float salary;

};

New cards
35

structure vARIABLE

A ________________ can be passed to a function in similar way as normal argument.

New cards
36

void funtion

It is simply a function that doesn't need to return anything

New cards
37

doesn't have any parameters

The empty parentheses in a function means that it _______________

New cards
38

overloaded function

Two or more functions having the same name but different argument(s)

New cards
39

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 <<"Age: " << p.age << endl;

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

}

New cards
40

ctype.h

This header declares a set of functions to classify and transform individual characters.

New cards
41

TEST STRING.

What is the output of the given program?

\#include
New cards
42

9 1 4

\#include
New cards
43

tolower()

It returns the lowercase version of a character expression:

New cards
44

strcpy()

Which of the following is a cstring function? Group of answer choices

fabs()

sqrt()

abs()

strcpy()

New cards
45

HELLO WORLD!

What is the output of the given program?

\#include
New cards
46

strlen()

It returns the length of a string

New cards
47

iscntrl()

Check if a character is a control character

New cards
48

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

New cards
49

1

What is the output of the given program?

\#include
New cards
50

word is found at index 10

What is the output of the given program?

\#include
New cards
51

H

What is the output of the following program?

\#include
New cards
52

Hello World

What is the output of the following program?

\#include
New cards
53

5

What is the output of the following program?

\#include
New cards
54

A member

Check the given structure:

struct Person

{

string name;

int age;

float salary;

};

The salary is :

New cards
55

structure

It is a collection of variables of different data types under a single name

New cards
56

Person s1, s2;

If you have a structure named Person, how can you create a structure variable named s1 and s2?

New cards
57

yes

Can you place an array inside a structure?

New cards
58

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?

New cards
59

Structure variable

\The instance of the structure is known as:

New cards
60

true

A structure variable can be passed to a function in a similar way as a normal argument

New cards
61

Person p,q;

Which of the following is the correct declaration of a structure variable?
Group of answer choices

Person p,q;

Person
New cards
62

60

What is the output of the following program?

\#include
New cards
63

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)

New cards
64

create an array of structure

What does struct Point arr[5]; do?

New cards
65

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 <<"Age: " << s.course << endl;

}

New cards

Explore top notes

note Note
studied byStudied by 145 people
450 days ago
5.0(1)
note Note
studied byStudied by 18234 people
650 days ago
4.8(59)
note Note
studied byStudied by 3 people
782 days ago
5.0(1)
note Note
studied byStudied by 30 people
310 days ago
5.0(1)
note Note
studied byStudied by 1 person
11 days ago
5.0(1)
note Note
studied byStudied by 47 people
747 days ago
5.0(2)
note Note
studied byStudied by 19 people
849 days ago
5.0(1)
note Note
studied byStudied by 1 person
47 days ago
4.0(1)

Explore top flashcards

flashcards Flashcard (45)
studied byStudied by 22 people
539 days ago
4.5(2)
flashcards Flashcard (31)
studied byStudied by 11 people
300 days ago
5.0(1)
flashcards Flashcard (178)
studied byStudied by 38 people
3 days ago
5.0(1)
flashcards Flashcard (29)
studied byStudied by 4 people
809 days ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 2 people
108 days ago
5.0(1)
flashcards Flashcard (136)
studied byStudied by 6 people
289 days ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 19 people
467 days ago
5.0(1)
flashcards Flashcard (158)
studied byStudied by 18 people
258 days ago
5.0(1)
robot