CSC 1300 Final

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/84

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:00 AM on 4/29/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

85 Terms

1
New cards
<p>In this declaration, Rock is</p>

In this declaration, Rock is

a tag

2
New cards

What allows you to access structure members

dot operator

3
New cards
<p>Given the structure declaration, which is the correct way to define an array named carLot of 20 Car variables?</p>

Given the structure declaration, which is the correct way to define an array named carLot of 20 Car variables?

Car carLot[20];

4
New cards

Which of the following assigns a value to the hourlyWage member of the third element in a structure array called employee?

employee[2].hourlyWage = 100.00;

5
New cards
<p>Given the structure declaration and given that there is a 20-element Car array named carLot that has already been defined in the main function, assign 14299 to the bluebookPrice member of the first element in the carLot array</p>

Given the structure declaration and given that there is a 20-element Car array named carLot that has already been defined in the main function, assign 14299 to the bluebookPrice member of the first element in the carLot array

carLot[0].price.bluebookPrice = 14299;

6
New cards

a function _____ returns a structure

may

7
New cards
<p>In this declaration, hardnessScale is </p>

In this declaration, hardnessScale is

a member

8
New cards

given the structure and assume a pointer variable to a Rectangle has already been created named myRectangle and it points to a dynamically allocated Rectangle array. At the end of the program, how would you release the allocated memory.

delete [] myRectangle;

9
New cards
<p>Given the structure declaration, which is the correct way to create a pointer variable to a Rectangle named myRectangle</p>

Given the structure declaration, which is the correct way to create a pointer variable to a Rectangle named myRectangle

Rectangle* myRectangle;

10
New cards
<p>given the structure declaration, what is the Tag of the structure</p>

given the structure declaration, what is the Tag of the structure

Dog

11
New cards

Data types that are created by the programmer are known as ___

abstract data types

12
New cards
<p>given the structure declaration, what are the variables definitions called inside the curly braces (dogName, breed, dogAge, and fixed)</p>

given the structure declaration, what are the variables definitions called inside the curly braces (dogName, breed, dogAge, and fixed)

members

13
New cards
<p>what is the correct syntax for dynamically allocating a Student array of 100 elements where Student is a structure </p>

what is the correct syntax for dynamically allocating a Student array of 100 elements where Student is a structure

Student* stuArray = new Student[100];

14
New cards

a structure ____ contain members of differing data types

can

15
New cards
16
New cards
<p>given the structure declaration and assume a pointer variable to a Rectangle has already been created name myRectangle. Would dynamically allocate an array of 100 Rectangle variables and use myRectangle to point to it</p>

given the structure declaration and assume a pointer variable to a Rectangle has already been created name myRectangle. Would dynamically allocate an array of 100 Rectangle variables and use myRectangle to point to it

myRectangle = new Rectangle[100];

17
New cards
<p>Which of the following statements outputs the value of the gpa member of the 2nd element of the student array given that Student structure has been declared in the source file</p>

Which of the following statements outputs the value of the gpa member of the 2nd element of the student array given that Student structure has been declared in the source file

cout « student[1].gpa;

18
New cards
<p>given the structure declaration and given that there is a 20-element Car array named carLot that has already been defined in the main function, what is the correct way to assign 2004 to the yearModel member of the first element in carLot</p>

given the structure declaration and given that there is a 20-element Car array named carLot that has already been defined in the main function, what is the correct way to assign 2004 to the yearModel member of the first element in carLot

carLot[0].yearModel = 2004;

19
New cards

a pointer variable is designed to store

a memory address

20
New cards
<p>what will the following program segment output</p>

what will the following program segment output

41

21
New cards
<p>what is the output of the following code segment:</p>

what is the output of the following code segment:

2 6 6

22
New cards
<p>what is the output of the following program</p>

what is the output of the following program

I=5, j=10

23
New cards

which of the following statements deletes memory that has been dynamically allocated for an array of 100 string elements named addresses

delete [] adresses;

24
New cards
<p>given the code segment below, what is the output of the program</p>

given the code segment below, what is the output of the program

6

25
New cards
<p>which code correctly calls the following function</p>

which code correctly calls the following function

float* nums; / nuts = createArray(9);

26
New cards
<p>should we use the delete operator on this array</p>

should we use the delete operator on this array

no

27
New cards
<p>what will the following code output</p>

what will the following code output

the memory address of the strPtr variable

28
New cards

if you are going to dynamically allocate an array where each element is a pointer to a double, which is the correct way to define the pointer to this array

double** scores

29
New cards
<p>what will the following code output</p>

what will the following code output

22

30
New cards

the ____ , also known as the dress operator, returns the memory address of a variable

ampersand (&)

31
New cards
<p>what will the following statement output</p>

what will the following statement output

the memory address of the variable called num1

32
New cards
<p>what is the out of the following program segment</p>

what is the out of the following program segment

50

33
New cards
<p>given the variable definition below, define a pointer variable named ptr and assign the memory address of num to the pointer variable</p>

given the variable definition below, define a pointer variable named ptr and assign the memory address of num to the pointer variable

int*ptr = &num;

34
New cards
<p>what is the output of the following code segment</p>

what is the output of the following code segment

4 8

35
New cards

the ____, also known as the dereference or indirection operator, returns the value of the variable or array element that the pointer is pointing to

asterisk (*)

36
New cards
<p>what does the following statement do</p>

what does the following statement do

declares a pointer variable named numPtr

37
New cards

which of the following statements deletes memory that has been dynamically allocated for an array

delete [] arrayName;

38
New cards

the individual values contained in an array are called _______

elements

39
New cards

to access an array element, use the array name and the element’s

index

40
New cards

array indexes begin with the number ____

0

41
New cards

an array can store a group of values, but the values must be the same ______

data type

42
New cards

valid C++ array definitions

int myNums[10];

43
New cards

a _____ is best to use in order to traverse through each element of an array

for loop

44
New cards
<p>the following programming statement shows an example of ______</p>

the following programming statement shows an example of ______

implicit array sizing

45
New cards
<p>how many elements does the following array have</p>

how many elements does the following array have

5000

46
New cards
<p>what is the last legal index/subscript that can be used with the following array</p>

what is the last legal index/subscript that can be used with the following array

17

47
New cards

the name of an array stores the ____ of the first array element

memory address

48
New cards

a two-dimensional array can be viewed as ____ and ____

rows, columns

49
New cards

to assign the contents of one integer array to another integer array of the same size you must use _____

a loop to assign the elements of one array to the other array one element at a time

50
New cards
<p>given the following declaration, where is 97 stored in the scores array</p>

given the following declaration, where is 97 stored in the scores array

scores[4]

51
New cards

an array of string objects that will hold 5 names would be declared using which statement

string names[5];

52
New cards
<p>what will the the following code segment display</p>

what will the the following code segment display

11 13 17 6 19

53
New cards
<p>given the program segment, write the missing programming statement that will read in a string containing spaces from the user, which should be placed in the character array named trait</p>

given the program segment, write the missing programming statement that will read in a string containing spaces from the user, which should be placed in the character array named trait

cin.getline(trait,50);

54
New cards

what should you use to store different types of related information on dogs. For example, you want to store multiple dog names and also store those dog’s ages

parallel arrays

55
New cards
<p>what will the following code segment display to the screen</p>

what will the following code segment display to the screen

16

56
New cards
<p>the following is a complete C++ program/ what will this program display. to the screen when it runs</p>

the following is a complete C++ program/ what will this program display. to the screen when it runs

6

57
New cards
<p>what would the following code segment display to the screen</p>

what would the following code segment display to the screen

34

58
New cards

to pass an array as an argument to a function, pass only the ____ of the array into the function call

name

59
New cards
<p>what will the following code segment display to the screen</p>

what will the following code segment display to the screen

11

60
New cards
<p>write the programming statement that correctly prints the second element of the vector defined below</p>

write the programming statement that correctly prints the second element of the vector defined below

cout « clocks.at(1);

61
New cards

you must #include <_____> to create and use a vector in your program

vector

62
New cards

data parallelism is where ____ is performed over ____ across multiple processors

the same task, different pieces of data

63
New cards

task parallelism is where ____ across multiple processors

different tasks are performed simultaneously

64
New cards

to allow file access in a program, you must #include the ____ header file

#include <fstream>

65
New cards

assuming outFile is a file object variable and temp is a double variable, which statement writes the contents of temp to the file associated with outFile

outFile « temp;

66
New cards

which of the following is correct to open a file assuming inFile is the file stream object variable

inFile.open(“filename.txt”);

67
New cards

read from a file assuming that inFile is a file stream object variable and content is a string variable

get line(inFile, content);

inFile.read(“content”);

inFile « content;

inFile » content;

get line(content,inFile);

68
New cards

correctly opens a file with file stream object variable name outFile in append mode

outFile.open(“myFile.txt”,ios::app);

69
New cards

which of the following bits associated with an input/output stream will be true if all other bits are false

goodbit

70
New cards
<p>the text file data.txt. contains data delimited by the ‘$’. what should be the test expression (condition) inside the while loop in the code segment below in order to read from the file</p>

the text file data.txt. contains data delimited by the ‘$’. what should be the test expression (condition) inside the while loop in the code segment below in order to read from the file

getline(inFileminput,’$’);

71
New cards

a(n) ____ is information that is passed to a function, and a(n) ___ is information that is received by a function

argument, parameter

72
New cards
<p>given this function prototype, what would be a vlid function call statement to this function</p>

given this function prototype, what would be a vlid function call statement to this function

calcArea(3.5,2.4);

73
New cards

a function can have zero to many parameters and it can return this many values(using the return statement)

only one

74
New cards
<p>what is the output of the following program</p>

what is the output of the following program

3 7 3

75
New cards
<p>what will the following program output</p>

what will the following program output

2 4 0 8 2 4

76
New cards
<p>what is the output of the following program</p>

what is the output of the following program

2 0 0

77
New cards
<p>what is the output of the following program</p>

what is the output of the following program

7

78
New cards
<p>which letter corresponds to the function header</p>

which letter corresponds to the function header

A

79
New cards
<p>which letter corresponds to the function prototypes</p>

which letter corresponds to the function prototypes

B

80
New cards
<p>which letter corresponds to the function call statement</p>

which letter corresponds to the function call statement

C

81
New cards
<p>which letter corresponds to the function body</p>

which letter corresponds to the function body

D

82
New cards
<p>which letter corresponds to the return type</p>

which letter corresponds to the return type

A

83
New cards
<p>which letter corresponds to the parameter list</p>

which letter corresponds to the parameter list

B

84
New cards
<p>which letter corresponds to the function name</p>

which letter corresponds to the function name

C

85
New cards
<p>which letter corresponds to the return statement</p>

which letter corresponds to the return statement

D