CS1D Exam1 Study Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A (single) linked list is traversed in only one direction.

true

A data type is simple if variables of that type can hold only one value at a time.

true

A doubly linked list can be traversed in either direction.

true

A function cannot return a value of type array

true

A function object is a class template that overloads the function call operator. 21n

true

A linked list in which the last node points to the first node is called a circular linked list.

true

A linked list is a dynamic data structure.

true

A linked list is a list of items, called nodes, in which the order of the nodes is determined by the address, called a link, stored in each node.

true

A linked list is a list of items, called nodes, in which the order of the nodes is determined by the address, called the link, stored in each node

true

A queue can be implemented as an array or a linked list.

true

A queue is a First In First Out (FIFO) data structure.

true

A queue is a data structure in which the items are added at one end and removed from the other end.

true

A single linked list only has a head pointer.

true

A stack can be implemented as an array or a linked list.

true

A stack is a Last In First Out (LIFO) data structure.

true

A stack is a data structure in which the items are added and deleted from one end only.

true

A stack is called a Last In First Out (LIFO) data structure

true

A struct is a collection of a fixed number of components in which the components are accessed by name. The components may be of different types [but are not required to be]

true

A vector container stores and manages its object in a dynamic array. page 1443.

true

Although as parameters, arrays are passed by reference, when declaring an array as a formal parameter, using the reserved word const before the data type prevents the function from modifying the array.

true

An array index can be any expression that evaluates to a nonnegative integer. The value of the index must always be less than the size of the array.

true

An array is a structured data type with a fixed number of components. Every component is of the same type, and components are accessed using their relative positions in the array.

true

Arrays can be initialized during their declaration. If there are fewer initial values than the array size, the remaining elements are initialized to 0.

true

As parameters to functions, arrays are passed by reference only.

true

Because C-strings are stored in arrays, individual characters in the C-string can be accessed using the array component access notation.

true

Because as parameters, arrays are passed by reference only, when declaring an array as a formal parameter, you do not use the symbol & after the data type.

true

C++ stores, in computer memory, two-dimensional arrays in a row order form

true

C-strings are compared character by character.

true

C-strings are stored in character arrays.

true

Character arrays can be initialized during declaration using string notation.

true

Commonly used C-string manipulation functions include strcpy (string copy), strcmp (string comparison), and strlen (string length).

true

Elements of a one-dimensional array are arranged in the form of a list

true

For a list of length n, selection sort makes exactly n(n-1)/2 key comparisons and 3(n-1) item assignments.

true

If matrix is a two-dimensional array, then the base address of matrix is the address of the array component matrix[0][0].

true

In C++, C-strings are null terminated.

true

In C++, a string is any sequence of characters enclosed between double quotation marks.

true

In C++, an array index starts with 0.

true

In C++, the null character is represented as '\0'.

true

In a doubly linked list, every node has two links: one points to the next node and one points to the previous node.

true

In a doubly linked list, item insertion and deletion require the adjustment of two pointers in a node.

true

In a function call statement, when passing an array as an actual parameter, you use only its name.

true

In a structured data type, each data item is a collection of other data items

true

In a two-dimensional array, the elements are arranged in a table form

true

In a two-dimensional array, the rows are numbered 0 to ROW_SIZE 1 and the columns are numbered 0 to COLUMN_SIZE 1.

true

In column processing, a two-dimensional array is processed one column at a time.

true

In postfix notation, the operators are written after the operands.

true

In row processing, a two-dimensional array is processed one row at a time.

true

In the ASCII character set, the collating sequence of the null character is 0.

true

In the array implementation of a stack, stackTop - 1 is the index of the top element in the stack

true

In the linked implementation of a stack, the operation isFullStack returns true if the stack is full. page 1174

true

Individual array components can be passed as parameters to functions

true

Input and output of C-strings is the only place where C++ allows aggregate operations.

true

Item insertion and deletion from a linked list do not require data movement; only the pointers are adjusted.

true

Parallel arrays are used to hold related information.

true

elements in an associative container are sorted according to some ordering criteria. 21l

true

every node in a linked list has a two components: one to store the relevant information and one to store the address. page 1072.

true

in C++, some aggregate operations are allowed for allowed for strings.

true

in a postfix expression, Operands are written after the operations. page 1201.

true

in a queue, the new element is added at the end of the queue. page 1215.

true

in the array implementation of a queue , the operation deleteQueue decrements, count by 1 and advances queueFront to the next element. 17 k

true

in the array implementation of a stack, to remove the top element of the stack , the operation pop decrements the vales of the stackTop by 1 if the stack is nonempty. page 1176.

true

in the linked implementation of a stack, stackTop contains the address of the top element of the stack.

true

the function adjacent_find is used to find the first occurrence of consecutive elements that meet certain criteria. 21q

true

the function copy is used to copy the elements from one place to another. 21h

true

the head pointer of a linked list should not be used to traverse the list.

true

the only allowable operations on a struct are assignment and member selection.

true

the size of an array is determined at compile time

true

the two most common operations on iterators are ++ and * (the dereferencing operator).

true

to a build a linked list forward, the new node is inserted at the end of the list.

true

to insert a new item in a linked list, create a node, store the new item in the node , and insert the node in the linked list.

true

a one-dimensional array is an example of a structured data-type.

true

a queue is a first in first out data structure. page 1215.

true

a range-based for loop can be used on sequence functions containers even if they are declared as formal parameters for to a function. 21i

true

a stack is a First In Last Out data structure. page 1167.

true

a stack is a list of the homogeneous elements in which the addition and deletion of elements occurs only at the end. page 1166

true

a struct is definition, not a declaration. page 611.

true

a struct variable can be passed as a parameter either either by value or by reference. page 617.

true

an array can be a member of a struct. page 619.

true

containers and iterators are class templates. page 1442

true

A single linked list can be traversed in either direction.

false

All members of a struct must be different types. page 610.

false

As parameters, two-dimensional arrays are passed either by value or by reference.

false

Given : char name[16] = "john k. miller"; declares name to be an array of 15 characters because the string "john k. miller" has only 14 characters.

false

If an array index goes out of bounds, the program always terminates in an error.

false

In a computer simulation, the objects being studied are usually represented as operations. 17 m

false

In postfix expression, operands are written before the operations

false

In the array implementation of a stack, stackTop contains the index of the top element in the stack. page 1172.

false

Some aggregate input/output operations are allowed on a struct variable. page 617.

false

When you declare a vector object and specify its size as 10, then only 10 elements can be stored in the object. 21d

false

a function can return a value of type array.

false

a function cannot return a value of the type struct. page 617.

false

a struct member is accessed by the using the operator :

false

arrays can be passed to a function either by value or by reference.

false

because a struct has a finite number of components, relational operations are allowed on a struct.

false

given the declaration: int [10]; the statement: list[5] = list[3] + list[2] this updates the content of the fifth component of the array list.

false

in a deque container elements cannot be inserted in the middle. 21j

false

in a linked list, memory allocated for the nodes is sequential.

false

in a linked list, nodes are always inserted either at the beginning or at the end because a linked list is not a random access data structure

false

in a linked list, the order of the elements is determined by the order in which the nodes were created to store the elements. page 1072.

false

in a linked list, typically, the link field of the last node points to itself.

false

in the array implementation of a stack, the operation top returns the index of the top element in the stack.

false

in the linked implementation of a queue, the queue is empty if queueFront == queueRear. 17 l

false

list containers are implemented as single linked list. 21k

false

predicate function objects return int values. 21o

false

simulation problems are solved using a stack. 17 n

false

struct variables must be declared after the struct definition. page 612.

false

suppose the nodes of a linked list are in the usual info-link form and current pointers to a node of the linked list. the current = current.link advances current to the next node in the linked list.

false

the declaration: char str = "sunny day"; declares str to be a string of an unspecified length.

false

the function end returns the position of the last element in the container. 21g

false

the function initializeList(); of the class unorderedLinkedListType initializes the list by only setting the pointers first and last to nullptr.

false

the function replace_if replaces all occurrences, within a given range, of a given element with a new value. 21p

false

the function resize is common to all containers. 21f

false

the function search of the class unorderedLinkList searches the linked list sequentially, while the function search of the classes orderedLinkedList searches the linked list using a binary search algorithm because it the data in an orderedLinkList object is stored.

false

the only aggregate operations allowable on int arrays are the increment and decrement operations

false

the stl containers are classified into the following categories sequence and associative

false

you can use iterators to step through elements of container adapters. 21m

false

Postfix expressions are evaluated according to the following rules: a. Scan the expression from left to right. b. If an operator is found, back up to get the required number of operands, evaluate the operator, and continue.

true

Postfix notation does not require the use of parentheses to enforce operator precedence.

true

Queues are restricted versions of arrays and linked lists.

true

Selection sort sorts the list by finding the smallest (or equivalently largest) element in the list and moving it to the beginning (or end) of the list.

true

Stacks are restricted versions of arrays and linked lists.

true

Suppose vecList is a vector object. the expression vecList.capacity() returns the number of elements that can be currently added to vecList. 21e

true

The STL containers are classified into three categories, as follows: Sequence containers, Associative containers, and Container adapters.

true

The base address of an array is the address of the first array component. For example, if list is a one-dimensional array, the base address of list is the address of list[0].

true

The basic operations on a queue are as follows: add an item to the queue, remove an item from the queue, retrieve the first or last element of the queue, initialize the queue, check whether the queue is empty, and check whether the queue is full.

true

The basic operations on a stack are as follows: push an item onto the stack, pop an item from the stack, retrieve the top element of the stack, initialize the stack, check whether the stack is empty, and check whether the stack is full

true

The first (or head) pointer of a linked list is always fixed, pointing to the first node in the list

true

The header file cstring contains the specifications of the functions that can be used for C-string manipulation.

true

The length of a linked list is the number of nodes in the list.

true

The middle elements of a queue should not be accessed directly.

true

The middle elements of a stack should not be accessed directly.

true

The pointer to a linked list—that is, the pointer to the first node in the list—is stored in a separate location called the head or first.

true

The search on a linked list is sequential.

true

The sequential search algorithm searches a list for a given item, starting with the first element in the list. It continues to compare the search item with the other elements in the list until either the item is found or the list has no more elements left to be compared with the search item.

true

There are no aggregate operations on arrays, except for the input/output of character arrays (C-strings).

true

There is no check on whether an array index is out of bounds.

true

To access an element of a two-dimensional array, you need a pair of indices: one for the row position and one for the column position

true

To remove, or pop, an element from the stack, we simply decrement stackTop by 1

true

To traverse a linked list, the program must use a pointer different than the head pointer of the list, initialized to the first node in the list.

true

When a two-dimensional array is passed as an actual parameter, the number of columns of the actual and formal arrays must match.

true

When declaring a one-dimensional array as a formal parameter, you usually omit the array size. If you specify the size of a one-dimensional array in the formal parameter declaration, the compiler will ignore the size.

true

When declaring a two-dimensional array as a formal parameter, you can omit the size of the first dimension but not the second.

true

You may optionally declare a struct variable when defining a struct, but by doing so, you make the variable global

true

a double type is an example of a simple data type

true

a doubly linked list can be traversed in either direction. page 1120.

true

a member of a struct can be another struct. page 623.

true


Ensembles d'études connexes

Synarthorosis A synarthrosis is a type of joint which allows no movement under normal conditions. Sutures, gomphoses and Syndesmoses are all synarthroses. Joints which allow more movement are called amphiarthroses or diarthroses.)

View Set

7. Coding Practice 1 3-2-1 Code It

View Set

Physics Chapter 18 A Multiple Choice

View Set

Chapter 51: Alterations in Musculoskeletal Function (Trauma, Infection, and Disease)

View Set