Test 4

Ace your homework & exams now with Quizwiz!

the structure pointer operator ___________

->

The null terminator stands for this ASCII code.

0

Look at the following declaration. enum Tree { OAK, MAPLE, PINE }; In memory, what value will the MAPLE enumerator be stored as?

1

After the following statement executes, what value is stored in the variable num? num = atoi("1000");

1000

The symbol for the scope resolution operator is _____ .

::

to use the standard template library functions designed to process C-strings you must include the _________

<cstring> directive

To use the strlen function in a program, you must also write #include ________.

<cstring></cstring>

A practical application of this function is to allow a user to enter a response of 'y' or 'Y' to a prompt.

A or B

Which of the following is an example of a C++ primitive data type?

All of these

You may use a pointer to a structure as a ________.

All of these

If a is a structure variable and p, a pointer, is a member of the structure, what will the following statement do? cout << *a.p;

Output the dereferenced value pointed to by p.

This is the escape sequence representing the null terminator.

\0

Look at the following structure declaration. struct Employee { string name; int idNum; }; In this declaration, Employee is:

a tag

Data types that are created by the programmer are known as ________.

abstract data types (ADT)

This describes only the general characteristics of an object.

abstraction

the functions toupper, and tolower each ________

accept a single character argument

"Whitespace" encompasses which of the following?

all of these

in C++ string literals__________

are enclosed in double quotes

Which statement converts the string "10" to the integer value 10?

atoi("10")

This function accepts a C-string as an argument and converts the string to a long integer.

atol

A structure ________ contain members of the same data type.

can

you ______ perform comparison operations on structure variables

cannot

To define a C-string that will store students' last names of up to 25 characters in length, which is an appropriate statement?

char lastName[26];

Which of the following lines of code defines an array of C-strings that will hold 49 characters and the null terminator?

char str[50];

One good reason to use C++ as a programming language is its _______ .

conciseness

Which of the following statements outputs the value of the gpa member of element 1 of the student array?

cout<<student[0];

The name of the structure is referred to as its ________.

data type

Before a structure can be used, it must be ________.

declared

) If an anonymous union is declared globally (outside all functions), it must be ________.

declared static

If Circle is a structure, the statement: Circle *pcirc = nullptr;

declares a structure pointer called pcirc initialized with a null pointer

toupper and tolower __________ to change

don't actually cause the character argument to change

This allows you to access structure members.

dot operator

The C-string company[12] can hold ________.

eleven characters and the null terminator

Which of the following assigns a value to the hourlyWage member of employee[2]?

employee[2].hourlyWage = 100.00;

A declaration for an enumerated type begins with the ________ key word.

enum

Passing a structure as a constant reference parameter to a function ________

guarantees not to result in changes to the structure's members

if you want to store a C-string in memory you _________

have to define a character array large enough to hold it plus one character

the dot operator has __________ the indirection operator

higher precedence

each structure variable is a separate __________

instance

With an enumerated data type, the enumerators are stored in memory as ________.

integers

in C++ the structure _________

is a mechanism for creating abstract data types

in C++ "26792"

is a string

in C++ the case of characters _________ while using strcmp

is used while making comparisons

To determine whether a character entered is a letter of the alphabet, use this function.

isalpha

This function will return true if its argument is a printable character other than a digit, letter, or space.

ispunct

To determine whether a character is whitespace, use this function.

isspace

if strcmp finds that two strings are equal on a character by character basis ___________

it returns a zero

A function ________ return a structure.

may

This library function reverses the order of a C-string.

none of these

given the code snippet: cout<< "What is your ID number?"; cin>> idnumber cout<< "What is your name?"; cin.getline(name, NAME_SIZE); what will be assigned to the variable 'name'?

nothing

the purpose of the _______ is to mark the end of a C-string

null character, or terminator

the isdigit function returns true if its argument is the character representation of _________

of any digits 0 through 9

To test whether a character is a printable character, use this function.

osprint

the strlen function accepts a _________ C-string as its argument

pointer to a

it is _______ to create an array of structures

possible

bool, char, and float would be examples of _________

primitive data types

once a string is stored in an array it can be ________

processed using standard subscript notation

When a structure is passed ________ to a function, its members are not copied

reference

given the statement: (*s).m ________

s is a structure pointer and m is a member

This is required after the closing brace of the structure declaration.

semicolon

This function concatenates the contents of one C-string with another C-string.

strcat

_________ is a generic term that describes a consecutive sequence of characters

string

This function accepts a pointer to a C-string as an argument, and it returns the length of the C-string (not including the null terminator).

strlen

you should use _________ because they require specification of the maximum number of characters to be appended from the second string to the first

strncat and strncpy

This function accepts pointers to two C-strings and an integer argument, which indicates how many characters to copy from the second C-string to the first.

strncpy

A library function that can find one C- string inside another is:

strstr

it is possible to define multiple _______ variables in a program

structure

the address of ________ may be used to make pointers to structures

structure varaibles

in order to improve efficiency it is often preferred to pass large objects such as ________ reference in order to avoid making a copy of it

structures

the name of a structure is its ________

tag

If Circle is a structure tag, the statement: Circle doSomething(Circle c2) can be the header line for a function that ________.

takes a Circle structure as a parameter, does something, and returns a Circle structure

A structure pointer contains ________.

the address of a structure variable

To dereference a structure pointer, the appropriate operator is ________.

the structure pointer operator, ->

A good reason to pass a structure as a constant reference is ________.

to prevent changes to the structure members

To change a lower case character to an upper case character, use this function.

toupper

the strcat function accepts ______ as its arguments

two pointers to C-strings

This is like a structure, except all members occupy the same memory area

union This is like a structure, except all members occupy the same memory area

the members of structure variables may be initialized with ________

values when the structure is defined

) The statement: char var1 = tolower('A'); will result in:

var1 storing the ASCII value for lower case 'a'.

C++ allows you to group several _______ into a structure

variables

Look at the following statement. bookList[2].publisher[3] = 't'; This statement ________.

will store the character 't' in the fourth element of the publisher member of booklist[2]


Related study sets

Econ- unit 1 (ch 3 lesson 1-5 & 7)

View Set

Trigonometry - Solving Trig Equations

View Set

Ch 1 & 2 International Management

View Set

Section: Rock and the Rock Cycle

View Set