A. last dimension can be skipped.
B. mid dimension can be skipped.
C. first dimension can be skipped.
D. any dimension cannot be skipped.
We do not need to initialize all elements in an array. If an array is partially initialized, elements that are not initialized receive the value 0 of the appropriate type.
A. array.
B. union.
C. double.
D. structure.
Array is a data-structure whose elements form a sequence. When elements of linear structures are represented in memory by means of sequential(contiguous) memory location, these linear structures are called arrays.
A. character.
B. alhanumeric.
C. numeric.
D. real.
Data type refers to to a named group of data which share similar properties or characteristics and, which have common behavior among them.
A. elements.
B. data types.
C. indexes.
D. classes.
An array is a collection of objects of the same data type, allocated contiguously in memory. Individual objects in an array, called elements, are accessed by their position in the array.
A. static array.
B. fixed size array.
C. resizable array.
D. dynamically-allocated array.
A dynamic array can be resized and it allows elements to be added or removed.
A. sorting.
B. ordering.
C. arranging.
D. merging.
Sorting algorithm is an algorithm that put elements of a list in a certain order. It can be in ascending order or descending order.
A. structure.
B. linked list.
C. stack
D. tree
Linked lists are special lists of some data elements linked to one another. The logical ordering is represented by having each element pointing to the next element. Each element is called a node, which has two parts : INFO and POINTER.
A. LIFO lists.
B. GIFO lists.
C. TIFO lists.
D. FIFO lists.
Queues data structures are FIFO ( First In First Out) lists, where insertions take place at the "rear" end of the queues and deletions take place at the "front" end of the queues.
A. reversing all numeric entries.
B. interchanging of row and column elements.
C. interchanging the top and bottom rows.
D. interchanging the left and right columns.
The result of transposing an m x n matrix is an n x m matrix with property :
MT(j,i) = M(i,j)
1<=i<=m,
1<=j<=n
A. struct.Marks.
B. STRUCT Marks
C. STUDENT.Marks.
D. STUDENT.MARKS.
Structure refers to a named collection of variables of different data types. A structure gathers atoms of information that form a given entity. The elements of a structure are referenced using the dot operator.
A. GIFO.
B. FIFO.
C. TIFO.
D. LIFO.
Stacks data structures refer to the lists stored and accessed in a special way, where LIFO (Last In First Out) technique is followed. In stacks, insertions and deletions take place only at one end, called the top.
A. trees and stacks.
B. simple and compound.
C. primitive and non-primitive.
D. LIFO and FIFO.
Simple data structures are normally built from primitive data types like integers, real and characters. For example, arrays and structures.
Simple data structures can be combined in various ways to form complex structures called compound data structures. Compound data structures are classified into following two types : Linear data structures and non-linear data structures.
A. 1 - 10.
B. 0 - 10.
C. 2 - 11.
D. 0 - 9.
Integers allows to only have digits ( 0 - 9) and +, - signs in the integer data i.e., numbers without fractions. C++ provides int data type to store integers.
A. *int [].
B. int [5].
C. int ** [5].
D. int * p[5].
It is an array of 5 int pointers.
A. reference pointer.
B. function pointer.
C. null pointer.
D. empty pointer.
A null pointer has a reserved value, often but not necessarily the value 0, indicating that it refers to no object.
A. dynamic memory allocation.
B. static memory allocation.
C. free store.
D. dereferencing memory.
The amount of memory needed is not known beforehand. When the program executes, i.e., during run time only memory is allocated, then it is dynamic memory allocation.
A. stack.
B. heap.
C. reserved area.
D. dynamic memory allocated area.
While a program executes, the stack region is used for many things. The stack is used for holding the return addresses at function calls, arguments passed to the functions and local variables for functions.
A. *num;
B. #
C. *num[I];
D. num;
Elements of an array can be accessed by *(num+i);
But, when *num is written, by default it returns the first element as
i=0, for the expression *(num + i).
A. zero.
B. one.
C. two.
D. many.
In C++, declaring pure virtual functions creates pure interfaces. A pure virtual function is declared as follows:
virtual void Activate() = 0;
A. address of a.
B. a.
C. an error.
D. the value of a.
The expression using & sign denotes the reference, hence this statement will print address(reference)of a.
A. compile time.
B. run time.
C. early binding.
D. starting of program.
Pointers point to an object created by class. Object pointers point to object at run time, also called late binding.
A. public members of an object.
B. private members of an object.
C. protected members of an object.
D. global members of an object.
Only public members are available to object members as they can be accessed by the code outside the class.
A. dot operator.
B. brackets.
C. access specifier.
D. arrow operator.
This is an arrow operator -> used to access public members of objects.
A. object pointer.
B. member function pointer.
C. address pointer.
D. this pointer.
The term 'this pointer' refers to the object on which we are currently working.
A. may be compatible with pointers to objects of a derived class.
B. may not be compatible with pointers to objects of a derived class.
C. should always be compatible with pointers to objects of a derived class.
D. should never be compatible with pointers to objects of a derived class.
This is the reason we use a single pointer variable to point to objects of base class as well as derived classes.
A. two pointers.(one for base class and one for derived class)
B. a single pointer.
C. many pointers.
D. four pointers. (two for base class, two for derived class)
Pointers to objects of base class type are compatible with pointers to objects of a derived class.
A. virtual class.
B. abstract class.
C. pure class.
D. derived class.
It is the pure interface within an abstract class, which define the common features encapsulated within it. They are the basis for the polymorphic behaviour of abstract classes. In C++, declaring pure virtual functions creates pure interface.
A. arrays and structures only.
B. arrays and functions only.
C. functions and structures only.
D. arrays, structures and functions.
We can use pointers explicitly with all these three: structures, functions and arrays. A structure is a collection of variables under a single name. The main body of a program, identified by the keyword main and enclosed by the left and right braces is a function. An array is a collection of like objects.
A. –3.
B. 0.
C. 4.
D. 4*sizeof (int).
Here, ptr=1 , x= *ptr-*a =1-1 =0.
A. base value.
B. main address.
C. temporary address.
D. base address.
A pointer holds the address of the very first byte of the memory location where it is pointing to. The address of the first byte is known as base address.
A. a non-constant pointer to constant data.
B. invalid.
C. a constant pointer to constant data.
D. a non-constant pointer to non- constant data.
The const char *myPointer, is a non constant pointer to constant data. While char *const myPointer is a constant pointer to non constant data.
A. pointer to a structure.
B. self referential structure.
C. structure with different data types.
D. structure with array.
A structure having a member element that refers to the structure itself, is known as self-referential structure.
A. 1 byte.
B. 2 bytes.
C. 4 bytes.
D. 3 bytes.
Integers can be added to or subtracted from pointers using the operators +, -, +=, and -=. Each time a pointer is incremented by 1, it points to the memory location of the next element of its base type. When a character pointer is incremented, its value increases by 1. In pointer arithmetic, all pointers increase and decrease by the length of the data type they point to.
A. float val = new float(10);
B. float val = new float[10];
C. float *val = new float(10);
D. float *val = new float[10];
The operator new can also allocate memory for user defined types like structures, arrays and classes. To allocate memory for a one-dimensional array, new can be used in the following form:
pointer-variable = new data-type[size];
where size is the size of the 1-D array i.e., number of elements in the array.
A. & in front of a structure pointer's name.
B. . (dot) in front of a structure pointer's name.
C. * in front of a structure pointer's name.
D. NULL in front of a structure pointer's name.
C++ allows pointers to structures just as it allows pointers to int or char or float or any other data type. The pointers to structures are known as structure pointers. It takes the following general form :
struct - name *struct-pointer;
where struct-name is the name of an already defined structure and struct-pointer is the pointer to this structure.
A. cout << N .
B. if (N == i + 3) .
C. cin >> N .
D. if (N == i + 4) .
Variables declared as const are not modifiable.
A. next Rolno.
B. next name.
C. next marks value.
D. structure Student itself.
A structure having a member element that refers to the structure itself is called self-referential structure. Here, *next refers to the structure Student itself. It is useful in defining linked lists wherein each element points to the next element of same type.
A. delete []student_list.
B. delete student_list.
C. delete []student.
D. delete student[size].
When new is used to allocate free store for an array, use the form delete []expression, where expression is the expression of the left side of the corresponding new statement.
A. You cannot declare a constant pointer whose pointed-at value is constant.
B. A const variable cannot be used on the left side of an assignment.
C. A const value must be intialized when it is declared.
D. When used alone in a declaration, the base type of a const variable is implicitly int.
You can declare a constant pointer whose pointed-at value is constant.
For example,
cont int* const cp = &M_size;
This would declare cp to be a constant pointer whose pointed-at value is constant. The remaining of the statements about using const are true.
A. allocates 20 integers and assigns the base address to p.
B. allocates 20 integers of the stack local to a block.
C. reads in 20 integer values from cin.
D. allocates an integer of size 20 bytes.
The new allocates space for 20 contiguous integers from free store.
A. code area, data area, stack area and heap.
B. new, delete, malloc and calloc.
C. heap, stack area, new and delete.
D. data area, stack area, new and delete.
Once a program is compiled, C++ creates four logically distinct regions of memory:
Code Area : Area to hold the compiled program code
Data Area : Area to hold global variables
Stack Area : Area to hold the return address of function calls, argument passed to the functions, local variables for functions and the current state of the CPU.
Heap : Area from which the memory is dynamically allocated to the program.
A. large number of bytes.
B. 4 bytes.
C. 1 byte.
D. 2 bytes.
Each time a pointer is incremented by 1, it points to the memory location of the next element of its base type. If “p” is a character pointer then “p++” will increment “p” by 1 byte. If “p” were an integer pointer its value on “p++” would be incremented by 2 bytes.
A. creates its own copy of the object.
B. destroys its copy of the object.
C. invokes the object's constructor to create its copy of the object.
D. does not create copy of the passed object.
When an object is passed by reference, the called function does not create its own copy of the passed object. Rather it refers to the original object using its reference or alias name. Therefore, neither constructor nor destructor function of the object is invoked in such a case.
A. 4.
B. 11.
C. 18.
D. 7.
The array notation arr[i] is equivalent to the pointer notation *(arr + i).
For the given code, if we write,
ptr ++;
it will point at 7
and
ptr-- ;
will point at 4.
A. delete.
B. new.
C. stored operator.
D. heap.
C++ defines two unary operators new and delete that peform the task of allocating and freeing (deallocating) memory during runtime. Since these operators new and delete operate upon the free store memory, they are called free store operators.
A. float x[]={ 2.6, 7.2, 3.1};
B. float *j;
C. k=k/2;
D. float *k;
Multiplication and division operations cannot be performed on pointer and k is a pointer.
A. def = &ab;
B. ++def;
C. cd++;
D. cd = &ab;
ab is an integer and cd is a char pointer.
A. pointer named marks
B. the value at the address in marks
C. the value stored in marks
D. the address in marks
The unary operator * returns the value of the variable located at the address following it(*-).
A. pointer.
B. reference.
C. new.
D. delete.
There are two important operators when working with pointers in C++: the address of (&) operator and the value of (*) operator.
A. is known.
B. can be known at any time.
C. can never be known.
D. is unknown.
In the dynamic memory allocation, the amount of memory to be allocated is not known. This memory is allocated during run-time as and when required. The memory is dynamically allocated using new operator.
A. pointers should be initialized with NULL.
B. a constant pointer always points to the same address.
C. a pointer to a constant always points to the same value.
D. adding 1 to a pointer adds the size of the base data type.
A pointer to a constant refers to a pointer which is pointing to a symbolic constant. Using a pointer to a constant, the constant value can not be modified, however, the pointer can be made to point to another location.
A. The array name is a pointer holding the address of the first element.
B. All memory allocated, static and dynamic, is freed when the program ends.
C. Memory is dynamically allocated from the free stack.
D. Addition and division are the arithmetic operations possible on pointers.
C++ treats the name of an array as if it were a pointer i.e., memory address of some element. C++ interprets an array name as the address of its first element.
A. a is a pointer, it cannot hold an array.
B. a is a pointer, it cannot be multiplied.
C. A is an array that has not been accessed.
D. no subscript (or index) has been declared for
A.
Only two arithmetic operations, addition and subtraction, may be performed on pointers.
A. insertion sort.
B. bubble sort.
C. selection sort.
D. merge sort.
Insertion sort has a linear running time (i.e., (n)). During each iteration, the first remaining element of the input is only compared with the right-most element of the sorted subsection of the array.
A. dynamic memory location.
B. static memory location.
C. contiguous memory location.
D. non-contiguous memory location.
In a one-dimensional array, elements are stored in adjacent memory locations.
A. the array should be linear.
B. the array should be sorted.
C. the array should be homogeneous.
D. the array should be non-linear.
A binary search algorithm (or binary chop) is a technique for locating a particular value in a sorted list.
A. homogeneous data structure.
B. non-homogeneous data structure.
C. linear data structure.
D. non-linear data structure.
Data structures like trees, binary trees, graphs, and heaps are non-linear data structures ,as the elements are stored without any order.
A. homogeneous data structure.
B. hetrogeneous data structure.
C. static data structure.
D. dynamic data structure.
The data structure, which contains different type of data, is known as a non-homogeneous data structure or heterogeneous data structure.
A. homogeneous data structure.
B. non- homogeneous data structure.
C. static data structure.
D. dynamic data structure.
When items or entities in a group are similar, then they are said to be homogeneous.
A. linear search.
B. binary search.
C. Lsearch
D. multilevel search.
A binary search algorithm is a technique for locating a particular value in a sorted list.
A. simple data structure.
B. compound data structure.
C. heterogeneous data structure
D. homogeneous data structure
Structure refers to a named collection of variables of different types. It is Simple Data Structure.
A. initial address.
B. flag address.
C. cell address.
D. base address.
In computing, a base address is an address serving as a reference point ,i.e., base, for other addresses.
A. size-0.5 and 1.
B. size-0 and 1.
C. size- 0 and 10.
D. size 0 and 0.5.
Size specifies the number of elements in an array. Array size(length) = upper bound-lower bound+1.
A. raw data.
B. data type.
C. data item.
D. data structure.
A named component of a data element, which usually is the smallest component, is known as data item.
A. row major form.
B. column major form.
C. cell major form.
D. row major or column major form.
Row major form stores the 2-D array row wise and column major stores the 2-D array column wise.
A. traversal.
B. sorting.
C. searching.
D. merging.
Traversal of a data structure means processing all the elements. In computer science, traversal refers to the process of visiting (examining and/or updating) each node in a tree data structure, exactly once, in a systematic way. Such traversals are classified by the order in which the nodes are visited.
A. traversal.
B. merging.
C. sorting.
D. searching.
A sorting algorithm is an algorithm that puts the elements of a list in a certain order.
A. subtraction.
B. addition.
C. searching.
D. multiplication.
Searching involves searching for the specified data element in a data structure.
A. array.
B. stack.
C. queue.
D. tree.
A queue is a particular kind of collection in which the entities in the collection are kept in order and the principal operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position.
A. array.
B. stack.
C. linked list.
D. tree.
A stack is an abstract data type and data structure, based on the principle of Last In First Out (LIFO).
A. a structure.
B. an array.
C. a queue.
D. a linked list.
An array is a homogeneous data structure, consisting of a group of elements that are accessed by indexing.
A. homogeneous data structure.
B. non-homogeneous data structure.
C. static data structure.
D. dynamic data structure.
In computer science, a static data structure is a data structure created for an input data set, which is not supposed to change within the scope of the problem.
A. selection sort.
B. bubble sort.
C. insertion sort.
D. quick sort.
In this type of sorting, we first find the smallest element in the array and exchange it with the element in the first position, then find the second smallest element and exchange it with the element in the second position. The process continues in this way until the entire array is sorted. This type of sorting is known as selection sort.
A. Structures and Trees.
B. Linked Lists, Queues and Arrays.
C. Arrays and Stacks.
D. Stack and Queues.
In computer science, a stack is a "last in, first out(LIFO)" abstract data type and data structure. A queue is a particular kind of collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position.
A. has a finite size.
B. has elements of different data types.
C. has a name that holds the value of the first element.
D. can be allocated randomly in memory.
An array is always defined with a finite size. For Ex - int ar[10]; ar is an array of size 10.
A. char, int, float, real, double.
B. char, natural, float, real.
C. char, int, float, double, void.
D. char, int, real, double, void.
Fundamental types in C++ are divided into three categories: integral, floating, and void. Integral types are capable of handling whole numbers. Floating types are capable of specifying values that may have fractional parts. The void type describes an empty set of values.
A. compound linear data structure.
B. simple data structure.
C. non-linear data structure.
D. fundamental data type.
An array is a systematic arrangement of objects, usually in rows and columns. it is a simple data-structure.
A. both have as many rows as columns.
B. both have same number of rows and columns.
C. the number of rows in one is same as number of columns in the other.
D. the number of elements is same in both.
Suppose A and B are mxn matrices. The sum of A and B , written as A+B, is the mxn matrix obtained by adding corresponding elements from A and B and the product of a scalar k and the matrix A, written as k.A, is the mxn matrix by multiplying each element of A by k.
A. both have as many rows as columns.
B. both have same number of rows and columns.
C. the number of rows in one is same as number of columns in the other.
D. the number of elements is same in both.
Suppose A and B are mxn matrices. The subtraction of A and B is the mxn matrix obtained only when the number of rows and columns of A and B are same.
A. both have as many rows as columns.
B. both have same number of rows and columns.
C. the number of rows in one is same as number of columns in the other.
D. the number of elements is same in both.
Suppose A and B are mxn matrices, then the product of A and B, written as AB, is the mxn matrix C, provided A is mxp and B is pxn matrix.
A. deletion
B. getting
C. extracting
D. removing
Deletion is one of the basic operation, performed on data-structure, to delete a data-element.
A. int anarray[10];
B. int anarray;
C. anarray{10};
D. array anarray[10];
The square brackets ([ ]) after the type int indicates that anarray is an array of type int. This declaration declares an array named anarray that contains 10 integers.
A. 10.
B. 90.
C. 9.
D. 19.
The number of rows = 5-(-3)+1 =9 (using UB-LB+1 for rows).
A. reversing all numeric entries.
B. interchanging of row and column elements.
C. interchanging the top and bottom rows.
D. interchanging the left and right columns.
In linear algebra, the transpose of matrix A is another matrix AT created by any one of the following equivalent actions : -write the rows of A as the columns of AT -write the columns of A as the rows of AT -reflect A by its main diagonal (which starts from the top left) to obtain AT
A. structure.
B. vector.
C. stack.
D. tree.
One-row matrix is called a row vector. Similarly, a one-column matrix is termed as a column vector. A null matrix is one with all elements being zero.
A. program.
B. pool of unallocated heap memory.
C. static memory allocation.
D. term used when system crashes.
A free store is a pool of unallocated heap memory given to a program that is used by the program for dynamic allocation during execution.
A. each element is in its proper position in a sorted sub array.
B. two adjoining values are compared and interchanged, if not in proper order.
C. the smallest value in the unsorted array is chosen and positions are exchanged.
D. values are arranged in different classes.
Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.
A. smallest key is repeatedly selected in the remaining unsorted array.
B. two adjoining values are compared and interchanged if not in proper order.
C. the smallest value in the unsorted array is chosen and positions are exchanged.
D. values are arranged in different classes.
Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) complexity, making it inefficient on large lists and generally performs worse than the similar insertion sort.
A. column minor.
B. column major.
C. row minor.
D. row major.
Row major linearization technique firstly stores the first row of the array, then second row of the array, then third row and so forth.
A. column minor.
B. column major.
C. row minor.
D. row major.
Column major linearization technique stores the first column, then the second column, then the third column and so forth.
A. the number of rows is greater than the number of columns in it.
B. the number of rows is less than the number of columns in it.
C. it has both rows and columns greater than 2.
D. the number of rows is equal to the number of columns in it.
While storing the elements of a 2-D array in memory, these are allocated contiguous locations. Therefore, a 2-D array must be linearised so as to enable their storage.
A. combine elements of two arrays to form a new array.
B. compare two adjoining values and interchange them, if not in proper order.
C. perform comparison sort in which the sorted array is built one entry at a time.
D. arrange values in different classes.
In bubble sort, the adjoining values are compared and exchanged if they are not in proper order. This process is repeated until the entire array is sorted.
A. leaves of the tree.
B. root of the tree.
C. info.
D. list.
Trees are multilevel data structures having a hierarchical relationship among its elements called nodes. Topmost node is called the root of the tree and bottommost nodes are called leaves of the tree.
A. arrays sorted only in ascending order.
B. arrays sorted only in descending order.
C. sorted arrays.
D. only arrays that are unsorted.
Binary Search searches for the given item in a sorted array. The search segment reduces to half at every successive stage.
A. only on arrays sorted in ascending order.
B. only on arrays sorted in descending order.
C. any kind of array.
D. only on arrays that are unsorted.
In linear search, each element of the array is compared with the given Item to be searched for, one by one. This method, which traverses the array sequentially to locate the given Item, is called linear search or sequential search.
A. 1042.
B. 1010.
C. 1100.
D. 0010.
Address of element with subscript I = Base address + ES (I - L)
where ES is size of an array element
L is the lower bound of the array
Therefore, address of SAMPLES[2] = 1000 + 2 ( 2 - (-3))
= 1000 + 2 (5)
= 1010.
A. 12.
B. 6.
C. 19.
D. 18.
When upper bound and lower bound of an array are given, its size is calculated as follows:
Array size (length) = UB - LB + 1
= 6 - (-12) + 1
= 18 + 1
= 19.
A. Editing, Traversal, Searching, Insertion.
B. Insertion, Printing, Modification, Traversal.
C. Creation, Insertion, Printing, Traversal, Sorting.
D. Insertion, Traversal, Deletion, Searching, Sorting.
The basic operations on arrays are :
Insertion - means addition of a new data element in an array.
Traversal - means processing all the data elements of an array.
Deletion - means removal of a data element from an array. The data element is searched for before its removal.
Searching - involves searching for the specified data element in an array.
Sorting - means arranging data elements of an array in a specified order.
A. one pointer, pointing to the next node.
B. two pointers, one pointing to the next, the other to the previous node.
C. one pointer, pointing to the last node.
D. two pointers, one pointing to first, the other to the last node.
In singly linked lists, nodes have one pointer (next) pointing to the next node, whereas nodes of doubly linked lists have two pointers (prev and next). Prev points to previous node and next points to the next node in the list.
A. linear search works.
B. binary search works.
C. random search works.
D. sequential search works.