(b) append x to A if there is room, and otherwise overwrites the currently last element of A
(c) append x to A if and only if the size of A is less than capacity of A
(d) append x to A, without checking the size and capacity of A
7. Consider the execution of the following.
vector<int> A(10,20);
Which of the following accurately describes what is created? (a)
(a) An array of 10 ints, each initialized to 20
(b) An array of 10 arrays of ints, each of size 20
(c) An array of ints, indexed from 10 to 20
(d) An array of 20 arrays of ints, each of size 10
2.1.3
1. Execution of which of the following statements sets an STL iterator it so that it points to the first element of a container A? (b)
(a) A.reset( it );
(b) it = A.begin();
(c) A.begin( it );
(d) begin( A, it );
2. For an STL iterator it, execution of the statement
it--;
does which of the following? (d)
(a) Pre-decrements the item to which the iterator points.
(b) Decreases by 1 the size of the container pointed to by it.
(c) Post-decrements the item to which the iterator points.
(d) Steps the iterator backwards to the previous item.
3. For an STL iterator it, execution of the statement
++it;
does which of the following? (c)
(a) Increase by 1 the size of the container pointed to by it.
(b) Post-increments the item to which the iterator points.
(c) Advances the iterator to the next item.
(d) Pre-increments the item to which the iterator points.
4. Access to ranges of elements in an STL container is typically handled by (c)
(a) suitable access member functions
(b) pointers
(c) iterators
(d) references
2.1
1. Consider the following C++ program segment, assuming that string is a class.
string str1("Hello, World");
str1[5] = 'Z';
The overloaded operator[] function invoked in the above program segment should have which of the following return types? (c)
数据结构试题库集及答案_IT认证_资格考试/认证_教育专区。数据结构试题库及答案 第一章 概论一、选择题 1、研究数据结构就是研究( D )。 A. 数据的逻辑结构 ...
第一章 概论一、选择题 1、研究数据结构就是研究( D )。 A. 数据的逻辑结构 B. 数据的存储结构 C. 数据的逻辑结构和存储结构 D. 数据的逻辑结构、存储...
数据结构试题库答案 隐藏>> 数据结构试题及答案 一、单项选择题 (1) 一个算法应该是( A) 程序 C) 要满足五个基本属性 (2) 算法指的是( A) 计算机程序 ...
数据结构试题库答案_理学_高等教育_教育专区。一些试题数据结构试题及答案一、单项选择题 (1) 一个算法应该是( A) 程序 C) 要满足五个基本属性 (2) 算法指的...
数据结构试题库_工学_高等教育_教育专区。数据结构一、选择题 1.采用折半查找方法进行查找,数据文件应为( A.有序表 顺序存储结构 C.随机表 顺序存储结构 2.算法...
线性,树,图 3.数据结构 S 中:元素的集合为:{A,B,C,D,E,F,G,H,I},关系的集合为:{<A,B>, <A,C>, <B,D>, <B,E>, <B,F>, <C,G>, ...
数据结构试题库及答案_工学_高等教育_教育专区。数据结构试题库及答案一、单选题(每题 2 分,共 20 分) 1.栈和队列的共同特点是( A )。 A.只允许在端点处...
数据结构题库 数据结构题数据结构题隐藏>> 第一章 绪论 一、选择题 1、数据结构是一门研究非数值计算的程序设计问题中计算机的 ① A、数据元素 ② A、结构 B...
数据结构题库数据结构题库隐藏>> 第1 章 绪论一、选择题 1. 算法的计算量的大小称为计算的( )。 A.效率 B. 复杂性 C. 现实性 D. 难度 2. 算法的时间...
热门文档