com207 Module 8 final exam latest 2017

Question # 00494918 Posted By: rey_writer Updated on: 03/04/2017 12:25 AM Due on: 03/04/2017
Subject General Questions Topic General General Questions Tutorials:
Question
Dot Image

Module 8 final exam

Question 1 You can use the built-in C++ __________ function to raise a number to a power and then return the result as a double number.

xy()

raise()

pow()

power()

Question 2 A(n) __________ is a block of code that performs a task.

program

expression

statement

function

Question 3 Unless specified otherwise, variables are passed by __________ in C++.

reference

copy

address

value

Question 4 For a program to create a file object, it must contain the __________ directive.

#include <ostream>

#include <fstream>

#include <iostream>

#include <istream>

Question 5 A __________ function uses its return value to send information back to the function that called it.

value-returning

built-in

program-defined

void

Question 6 Of the formal parameters in the replace function, __________ is optional.

replacementString

count

none of the above

subscript

Question 7 The __________ statement replaces the letter located in position 3 in the item variable, with the letter “D”.

item.replace("D", 3);

item.replace(3, 1, "D");

item.replace(3, "D");

item.replace(1, 3, "D");

Question 8 __________ declares and initializes a five-element double array named prices; the first element is initialized to 6.5, while the others are initialized to 0.0.

double prices[5] = {6.5,,,,};

double prices[] = {6.5};

double prices[] = {6.5,,,,};

double prices[5] = {6.5};

Question 9 The statement __________ opens the payroll.txt file for output.

outFile.open(ios::app, "payroll.txt");

outFile.open(ios::out, "payroll.txt");

outFile.openOut("payroll.txt");

outFile.open("payroll.txt");

Question 10 Executing:

string phone = "3120501111";

phone.insert(0, "(");

phone.insert(__________ , ")"); // Fill in the blank

phone.insert(8, "-");

changes the contents of the phone variable to “(312)050-1111”.

5

3

4

6

Question 11 Every C++ program contains at least one function: __________.

return()

rand()

main()

pow()

Question 12 When passing a two-dimensional array, the __________ set of square brackets in the formal parameter of a function header or prototype may be left empty.

both first and second

first

neither first nor second

second

Question 13 Connecting strings together is called __________.

concatenating

joining

uniting

linking

Question 14 A(n) __________ is a group of variables that have the same name and data type and are related in some way.

scalar variable

array

object

class

Question 15 _________ assigns a user-entered value to the element located in the third row, second column of the grades array.

cin << grades[2][1];

cin << grades[3][2];

cin >> grades[3][2];

cin >> grades[2][1];

Question 16 When referring to an element in an array, the element’s subscript must be placed between __________.

[]

‘’

“”

{}

Question 17 __________ assigns the character F to the variable located in the second row, first column of the grades array.

grades[1][0] = 'F';

grades[0][1] = 'F';

grades[1][2] = 'F';

grades[2][1] = 'F';

Question 18 The __________ is the Not logical operator in C++.

~

!

#

^

Question 19 Consider the array declared using the double prices[2][4] = { { 2.99, 14.99, 8.99, 24.99 }, { 1.99, 12.99, 6.99, 20.99 } }; statement. The statement prices[1][2] = prices[0][2]; will replace the number __________.

20.99 with 24.99

8.99 with 6.99

12.99 with 14.99

6.99 with 8.99

Question 20 __________ declares and initializes a four-element string array named sales; each element is initialized to 0.0.

string sales[4] = {0.0, 0.0, 0.0, 0.0};

string [4]sales = {0.0};

string sales[] = {0.0};

string sales[4] = {};

Question 21 In C++ you can use the __________ function to access any number of characters contained in a string variable.

access

substr

charAt

substring

Question 22 The __________ statement shows the prototype of a function that receives an array of double elements.

void displayArray(double []);

void displayArray(double);

void displayArray(double *);

void displayArray(double [*]);

Question 23 In C++, two-dimensional arrays are automatically passed __________ to functions.

by reference

by address

by value

by subscript

Question 24 Executing:

string name = "Rob Smith";

name.insert(4, "T. ");

changes the contents of the name variable to __________.

“Rob T. Smith”

“Rob T.Smith”

“RobT.Smith”

“RobT. Smith”

Question 25 The computer uses a file __________ to keep track of the next character either to read from or write to a file.

stream

iterator

pointer

object

Dot Image
Tutorials for this Question
  1. Tutorial # 00491434 Posted By: rey_writer Posted on: 03/04/2017 12:26 AM
    Puchased By: 4
    Tutorial Preview
    The solution of com207 Module 8 final exam latest 2017...
    Attachments
    module_8_final_exam_com207.docx (128.82 KB)
    Recent Feedback
    Rated By Feedback Comments Rated On
    jr...h91 Rating Plagiarism-free work 01/08/2018
    ma...ama Rating Provide reliable and excellent services 05/30/2017

Great! We have found the solution of this question!

Whatsapp Lisa