Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 39 Suppose that the values of two integer variables in main, x and y, are to be swapped by calling a swap function which

QUESTION 39

Suppose that the values of two integer variables in main, x and y, are to be swapped by calling a swap function which returns no value.

What could the prototype for the swap function look like?

a.

void swap( int &, int & );

b.

void swap( int, int );

c.

void swap()

1 points

QUESTION 40

I want to call a function, and have it pass back two calculations. What will I need?

a.

An object.

b.

A structure.

c.

A constructor.

d.

At least one reference.

1 points

QUESTION 41

void testfn( double &, double & ); //is a prototype for a function.

Which of the following is a valid calling statement for the function testfn, assuming that var1 and var2 are double variables?

a.

testfn( *var1, *var2 );

b.

testfn( var1, var2 );

c.

testfn( &var1, &var2 );

1 points

QUESTION 42

str1

c a t \0

str2

d o g \0

Using the two strings above, what will the following code display?

if( strcmp( str1, str2) == 0 ) cout << str1 << " is equal to " << str2; else if ( strcmp( str1, str2) < 0 ) cout << str1 << " is less than " << str2; else cout << str1 << " is greater than " << str2;

a.

cat is equal to dog

b.

cat is less than dog

c.

cat is greater than dog

1 points

QUESTION 43

If a c string will need room to hold a maximum of 80 characters, how should it be defined so that it will be treated as a VALID string?

a.

char ar[];

b.

char ar[81];

c.

char ar[80];

d.

char ar[79];

1 points

QUESTION 44

strcat(string1, string2); //places a null terminated copy of string2 into the middle of string1

a.

true

b.

false

1 points

QUESTION 45

The strlen function returns the _________.

a.

number of characters in a string, not including the null terminator

b.

number of characters in a string, including the null terminator

1 points

QUESTION 46

Which was used first from the list below in the history of C and C++ language?

string class

string method substring

character arrays (c strings)

string constructor

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions