Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 33 pages
Exam (elaborations)

CSCI 121 FINAL EXAM 2025 WITH 100% ACCURATE SOLUTIONS

Document preview thumbnail
Preview 4 out of 33 pages

CSCI 121 FINAL EXAM 2025 WITH 100% ACCURATE SOLUTIONS

Content preview

CSCI 121 FINAL EXAM 2025 WITH 100%
ACCURATE SOLUTIONS


When you have a function that expects an array, it should also
expect the size of the array or the number of indexed variables
with valid data. (T/F) - Answer True


How many indexed variables does the following array have? int
myArray[12]={1,2,3,6,5,4,7,1,2}; - Answer 12


In the expression
cout << score[i]<< endl;
i is called the ________. - Answer index


The computer remembers the address of which indexed
variable(s) in an array? - Answer 0


What is wrong with the following code?
float total[8], scores[10];
a.) The 10 should be replaced with a variable name, whose value
is input from the user.

,b.) Cannot declare two array variables with different size
together.
c.) Cannot declare two array variables together
d.) nothing - Answer D


What is wrong with the following code fragment?
const int SIZE=5;
float scores[SIZE];
for( int i=0; i<=SIZE; i++){
cout<<"Enter a score";
cin>>scores[i];
}
a.) Array indexes start at 1 not 0.
b.) Arrays must be integers.
c.) Array indexes must be less than the size of the array.
d.) Should be cin >> scores[0]; - Answer C


Which of the following function declarations could be used to
input data from the keyboard into the array?
a.) void input(int array[], int &numElements, int MAX_SIZE);
b.) void input(int array[], int numElements, int MAX_SIZE);
c.) void input(int &array[], int numElements, int MAX_SIZE);

,d.) int array[] input(int array[], int &numElements, int
MAX_SIZE); - Answer A


Which of the following will correctly assign all the values in one
array to the other array? (Assume both arrays are of the same
type and have SIZE elements.)
a.) array1=array2;
b.) array1[]=array2;
c.) for(i=0;i<SIZE;i++)
array1[i]=array2[i];
d.) for(i=0;i<SIZE;i++)
array1[]=array2[]; - Answer C


The following code declares a vector of characters.vector
characters<char>
(T/F) - Answer False


Vector assignment is well behaved. (T/F) - Answer True


A string variable and a c-string are the same data type. (T/F) -
Answer False

, The function used to "put two c-strings together into one" is
called ________. - Answer strcat


A character array terminated with the null character is most
correctly called______.
a.) a c-string.
b.) a character array.
c.) a string.
d.) None of these. - Answer A


What is the value of numbers.size() after the following code?
vector<float>numbers;
numbers.reserve(100); - Answer 0


When the extraction operator is used to read data into a string
a.) it skips all white spaces.
b.) it skips only new lines.
c.) it reads everything on the line.
d.) it reads as many characters that will fit into the c-string. -
Answer A

Document information

Uploaded on
December 3, 2024
Number of pages
33
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
YANCHY
4.1
(449)
Sold
1786
Followers
1159
Items
23426
Last sold
1 week ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions