A. 266
B. 264
C. 262
D. 278
Base address B = 250
Element size w = 2 bytes
No. of columns n = 6
Lr = 1; Lc =0
Location R[3,2] = 250 + 2 (6(3-1)+(2-0))
= 250 + 2 (6(2)+(2))
= 250 + 2 (12+2)
= 250 + 2 (14)
= 250 + 28
= 278
A. 930.
B. 1176
C. 1160
D. 1076
Base address B = 500
Element size w = 1 byte
r (number of rows) are 20-(-20)+1=40+1=41
Ir = -20; Ic = 10
Address of A[0,20] = 500 + 1(0-(-20)+41(20-10))]
= 500 + 1(20 + 41 x 10)
= 500 + (20+410)
= 500 + (430)
= 930.
A. 272
B. 242
C. 262
D. 252
Base address B = 220
Element size w = 2 bytes
number of columns = 4
Lr = 1 ; Lc = 1
Location R [6,2] = 220 + 2 (4 (6-1)+(2-1))
= 220 + 2 (4 (5) + (1))
= 220 + 2 (21)
= 220 + 42
= 262.
A. column minor
B. column major
C. row minor
D. row major
This linearization technique stores first the first column, then the second column, then the third column and so forth. The formula for address calculation of (I, J)th element in array X(Lr : Ur, Lc : Uc) with base address B and element size w is given below:
Address(I,J) = B + w[r(J-Lc)+(I-Lr)]
where r is the number of rows i.e. length of a column array Lr : Ur i.e., Uc - Lc +1.
A. column minor
B. column major
C. row minor
D. row major
This linearization technique stores first the first row of the array, then the second row, then the third column and so forth. The formula for address calculation of (I, J)th element in array of m x n elements with base address B and element size W bytes is given below:
Address of (I,J) in Row-major order = B + W[n(I-1)+(J-1)]
where m are the number of rows and n are the number of columns.
More generalized form of formula for address calculation of [I,J] element of array AR[(Lr : Ur, Lc : Uc) with base address B and element size w is given below:
Address(I,J)th element = B + W[n(I-Lr)+(J-Lc)]
where n is the number of columns i.e. length of array [Lc : Uc] i.e., Uc - Lc +1:Lr is first row number, Lc is first column number.
A. each element is inserted 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
In insertion sort, each successive element is picked and inserted at an appropriate position in the previously sorted array. This sorting algorithm is frequently used when n is small.
A. each element is inserted 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
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. each element is inserted 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
In selection sort, the smallest (or largest depending upon the desired order) key from the remaining unsorted array is searched for and put in the sorted array. This process repeats until the entire array is sorted.
A. Binary and Linear are two popular sorting techniques.
B. Merge-sort creates a sorted output.
C. Bubble and selection are popular searching techniques
D. A data structure with a pointer is a structure.
Merging means combining elements of two arrays to form a new array. Simplest way of merging two arrays is that first copy all the elements of one array into new array and then copy all the elements of other array into new array. If you want the resultant array to be sorted, you can sort the resultant array.
A. Binary search works if the array is in ascending order
B. The array name is like a pointer
C. An element cannot be deleted from a sorted array
D. An array can store pointers.
Binary search can work for only sorted arrays whereas linear search can work for both sorted as well as unsorted arrays. The element to be deleted is first searched for in the array using one of the search techniques i.e., either linear search or binary search. If the search is successful, the element is removed and rest of the elements are shifted so as to keep the order if array undisturbed.
A. values.
B. subscripts.
C. data.
D. bounds.
The subscript or index of an element designates its position in an array.
A. Binary Search.
B. Linear Search.
C. Quick Search.
D. Tree Search.
Binary Search searches for the given item in a sorted array. The search segment reduces to half at every successive stage.
A. Binary Search.
B. Linear Search.
C. Quick Search.
D. Tree Search.
In linear search, each element of the array is compared with the given Item to be searched for, one by one.
A. 810 * 64-*28+.
B. 810 * 64-+28*.
C. 810 **64- 28+.
D. *810 64-*28+.
8*10*(6-4)+28 = (810*)*(64-)28+ = 810 * 64-*28+.
A. rear end.
B. front end.
C. front or rear end.
D. second index element, leaving first index for null.
Front stores the index of first element in the queue. In a queue deletion is always takes place at the front end.
A. rear end.
B. front end.
C. front or rear end.
D. second last index element, leaving last index for null.
Rear stores the index of last element in the queue. In a queue insertion of elements is always takes place at the rear end.
A. postfix notation.
B. prefix notation.
C. infix notation.
D. increment notation.
Infix notation is the common arithmetic and logical notation where operators are placed in between the operands.
A. insertion and deletion.
B. modification and display.
C. traversal.
D. push and pop.
Push is to insert an element in a stack, whereas pop is to delete an element from the stack.
A. Front=2 and rear =4.
B. Front=1 and rear=3.
C. Front=0 and rear=2.
D. Front=-2 and rear=4.
Deletion takes place at the front end which increase the value of front. Thus deletion of 2 elements cause front to increase by 2 and rear remains same.
A. circular queues.
B. linked queues.
C. dequeue.
D. simple queues.
Linked queues have links among its elements and it maintains two pointers to store the "front" position and "rear" position.
A. a b AND OR a AND c.
B. a AND b OR a AND c
C. a AND b OR a c AND.
D. a AND b a AND c OR.
The operator comes in between operands in infix expression. Example: a, b, AND, a, c, AND, OR = (a AND b a AND c) OR = a AND b OR a AND c.
A. linked queue.
B. input restricted queue.
C. circular queue.
D. dequeue.
Circular queues are implemented in circular forms rather than in straight lines. That is why, if space is there in the beginning, the rear shifts back to the beginning after reaching the maximum possible index number.
A. the rear end only.
B. the front end only.
C. both rear and front end.
D. the middle of the queue.
It is just like the simple queue where front end gets modified when deletion takes place.
A. the rear end only.
B. the front end only.
C. both rear and front end.
D. the middle of the queue.
It is like a simple queue where rear end gets modified when insertion takes place.
A. Front=2 and rear =4.
B. Front=1 and rear=5.
C. Front=0 and rear=6.
D. Front=1 and rear=6.
At every insertion, value of rear increases by 1 and front remains the same. Here rear will be increases by 2 and front will remain the same.
A. circular queues.
B. linked queues.
C. dequeue.
D. simple queues.
Linked queues have links among its elements, and it maintains two pointers to store the "front" position and "rear" position.
A. front decreases by 1.
B. front increases by 1.
C. rear decreases by 1.
D. rear increases by 1.
Deletion takes place at the front end, and always increases value of front according to the number of deletions.
A. pushing.
B. dropping.
C. popping.
D. inserting.
To delete an element in a stack, we use pop operation. We can pop the top most elements in a stack.
A. pushing.
B. dropping.
C. popping.
D. inserting.
To add an element in a stack, we use push operation.Thus the process refers to "pushing"
A. destructive queue.
B. destroy queue.
C. double ended queue.
D. delete queue.
Dequeue is a queue in which elements can be added or removed at either end.
A. unoccupied list.
B. node list.
C. store list.
D. avail list.
A free pool is a list keeping account of available free memory. It is a data structure used in a scheme for dynamic memory allocation. It operates by connecting unallocated regions of memory.
A. occupied storage.
B. unavailable list.
C. free storage.
D. garbage storage.
The other name for free storage list is free pool and it keeps an account of the freely available memory.
A. polish notation.
B. reverse polish notation.
C. prefix expression.
D. pushing.
Prefix expression(also called polish notation of an expression). It is an expression where operators are placed before operands.
A. PQ-MN*/R+.
B. P-QMN/*R+.
C. PQ-MN/*R+.
D. PQ-MN/*+R.
(P-Q)*(M/N) +R = (PQ-)*(MN/) R+ = PQ-MN/*R+.
A. AB+CD*/Z-.
B. AB+ / CD* Z.
C. +AB / *CD-Z.
D. -/+AB*CDZ.
In prefix expression, operators are placed before the operands.
Here, the expression (A+B) / (C*D)- Z = (+AB / *CD )-Z = -/+AB*CDZ
A. -+AB/DX.
B. AB+DX/-.
C. -A+B/DX.
D. -+/ABDX.
In prefix expression, operators are placed before the operand. Here, A+B-D/X I= +AB - /DX = -+AB/DX.
A. 8 * 10 + ((6-4) * 28).
B. 8*10*(6-4)+28.
C. 8+ 10 * (6-4) *28.
D. 8*10* (6+4) – 28.
In an infix expression, operators are placed between its operands.
A. G, F, E (on top).
B. A, B, C (on top).
C. E, F, G(on top).
D. C, B, A (on top).
Step 1: A, B, C, D, E, F (on top). Step 2: A, B, C, D, E (on top). Step 3: A, B, C, D (on top). Step 4: A, B, C (on top).
A. 85+69**63+-.
B. 85+69**63-+.
C. 85+*69*63-+.
D. 85+69**+63-.
[(85+) * (69*)]+(63-) = (85+69**) + (63-) = 85+69**63-+.
A. 215.
B. 665.
C. 1620.
D. 1625.
It would be (20+45) *((20-10) + 15) = 65 * 25 = 1625.
A. A, B, C, D, E, F, G, M, K (on top).
B. K, M, A, B, C, D, E, F (on top).
C. (on top) M, K, B, C, D, E, F, G.
D. A, B, C, D, E, F, K, M (on top).
Push and Pop operations can take place only at one end.
It would be
Step 1: A, B, C, D, E, F.
Step 2: A, B, C, D, E, F, K.
Step 3: A, B, C, D, E, F, K, M.
A. 10.
B. 20.
C. 40.
D. 50.
As a stack is implemented in LIFO manner, so the last element to be pushed in the stack is first element to be popped up.
A. [(8+5)* (6*9)] + (6-3).
B. [(8*5)+ (6*9)] + (6-3).
C. [(8+5)* (6-9)] * (6-3).
D. [(8*5)+ (6*9)] - (6+3).
In an infix expression, operators are placed between operands.
A. AB+CD*/-Z.
B. AB+CD/*Z-.
C. AB+CD*/Z-.
D. ABCD*/Z-+.
In postfix expression, operator comes after the operand. Here, the expression (A+B) / (C*D)- Z = AB+ / CD* Z- = AB+CD*/Z-
A. AB+DX-/.
B. AB+DX/-.
C. ABDX+/-.
D. ABDX/-+.
In postfix expression, operator comes after the operand. Here, A+B-D/X = AB+ - DX/ = AB+DX/-.
A. 3rd position.
B. 2nd position.
C. 1st position.
D. the last position.
Insertion always takes place at the rear end. front rear
| 0 | 1 | 2 | 3 | 4 |
A. front end.
B. rear end.
C. both front and rear end.
D. middle element.
Front stores the index of first element in the queue. Rear stores the index of last element in the queue. The formula to calculate the number of elements in a queue is = front - rear + 1
AVAIL list keeps account of the available memory locations. It is used when memory is allocated during run time.
Stages are:-
|
|
Element |
Operation |
Stack |
|
1 |
20 |
push |
20 |
|
2 |
10 |
push |
20 10 |
|
3 |
+ |
pop pop perform 20 + 10 push result |
30 |
|
4 |
12 |
push |
30 12 |
|
5 |
10 |
push |
30 12 10 |
|
6 |
- |
pop pop perform 12 - 10 push result |
30 2 |
|
7 |
* |
pop pop perform 30 * 2 push result |
60 |
|
8 |
4 |
push |
60 4 |
|
9 |
1 |
push |
60 4 1 |
|
10 |
- |
pop pop perform 4 - 1 push result |
60 3 |
|
11 |
3 |
push |
60 3 3 |
|
12 |
^ |
pop pop perform 3 ^ 3 push result |
60 27 |
|
13 |
+ |
pop pop perform 60 + 27 push result |
87 |
Stages are:-
|
|
Element |
Operation |
Stack |
|
1 |
15 |
push |
15 |
|
2 |
3 |
push |
15 3 |
|
3 |
+ |
pop pop perform 15 + 3 push result |
18 |
|
4 |
4 |
push |
18 4 |
|
5 |
* |
pop pop perform 18 * 4 push result |
72 |
|
6 |
6 |
push |
72 6 |
|
7 |
7 |
push |
72 6 7 |
|
8 |
5 |
push |
72 6 7 5 |
|
9 |
- |
pop pop perform 7 - 5 push result |
72 6 2 |
|
10 |
/ |
pop pop perform 6 / 2 push result |
72 3 |
|
11 |
- |
pop pop perform 72 - 3 push result |
69 |
: Input expression : (true AND false) OR NOT(false OR True)
|
|
Element |
Stack |
Expression Y in Postfix |
|
1 |
|
( |
|
|
2 |
( |
(( |
|
|
3 |
true |
(( |
true |
|
4 |
AND |
((AND |
true |
|
5 |
false |
((AND |
true false |
|
6 |
) |
( |
true false AND |
|
7 |
OR |
(OR |
true false AND |
|
8 |
NOT |
( OR NOT |
true false AND |
|
9 |
( |
(OR NOT ( |
true false AND |
|
10 |
false |
(OR NOT( |
true false AND false |
|
11 |
OR |
(OR NOT(OR |
true false AND false |
|
12 |
true |
(OR NOT(OR |
true false AND false true |
|
13 |
) |
(OR NOT |
true false AND false true OR |
|
14 |
) |
|
true false AND false true OR NOT OR |
In a linear queue, insertions are at the rear and deletions are from the front. As more elements are added, rear keeps moving ahead and ultimately reaches the last location of the array. As more elements are deleted, front also moves ahead, leaving behind locations from which values have been extracted. An attempt to insert another value at this stage would give an error, “Overflow” , as the queue is considered full if rear has reached the last array location, even if there is space available before front.
In case of circular queue, this space is utilized. When rear is at the end of the array, it moves to the first location and stores a value. Thus, the array is considered full when front is at the first position and rear is at the last, or, when rear lies just before front.
front rear
|
|
|
34 |
45 |
Q[0] Q[1] Q[2] Q[3]
Consider the above example where front is at index number 2 and rear is at index 3. In a linear queue, no more elements can be added.
But in a circular queue, read would become 0 and store a value. Thus, the 2 locations before front will be used.
Deque or double-ended queue, is a special kind of queue in which elements can be inserted and deleted from either end, but not in the middle.
The deque can be of two types – input restricted deque and output restricted deque.
An input restricted deque is a dequeue which allows insertions are allowed at one end but allows deletions at both ends of the list.
A. Parameter declarations
B. Arguments
C. Function definitions
D. Parameter definitions
Two or more functions can share the same name as long as their parameter declarations are different. This could include:
A. Encapsulation
B. Overriding
C. Data hiding
D. Polymorphism
Polymorphism is the ability of an object to behave differently in different circumstances can effectively be implemented in programming through function overloading.
A. Default arguments
B. Static arguments
C. Constant arguments
D. Function arguments
Constant arguments prevent temporary modification of the argument. The keyword const added in the beginning of an argument declaration, to prevent the argument from being modified within the body of the called function.
A. Function arguments
B. Function parameters
C. String arguments
D. Default arguments
Default arguments are useful in situation where some arguments always have the same value. It provides greater flexibility to the programmer. It can be used to add new parameters to an existing function.
A. Function arguments
B. Function parameters
C. Default arguments
D. String arguments
They are the values given in the function declaration that compiler automatically inserts during the function call. Such insertion is done when the caller does not provide a value for that argument in the function call.
A. Reduces
B. Increases
C. Doubles
D. Triples
Function overloading reduces number of comparisons in a program and thereby making the program run faster.
A. Early binding
B. Dynamic binding
C. Binding
D. Static binding
Late binding is also known as dynamic binding. In late binding, the binding is done at the run time (during program execution).
A. Late binding
B. Late binding
C. Binding
D. Static binding
Early binding is also known as static binding. In early binding, the binding of identifiers is done at the compile time.
A. Three
B. Two
C. Four
D. Five
Binding is of two types – early binding and late binding. In early binding, the binding of identifiers is done at the compile time. In late binding, the binding is done at the run time (during program execution).
A. Three
B. Four
C. Two
D. Five
Function overloading can be achieved by passing different number of arguments and by passing different types of arguments.
A. Encapsulation
B. Overriding
C. Binding
D. Polymorphism
C++ implements polymorphism through overloaded functions. The overloaded functions are invoked by matching arguments, both type of arguments and number of arguments.
A. Function overloading
B. Function overriding
C. Encapsulation
D. Polymorphism
Method with the same name and different signature result in function overloading. Function overloading is used to enhance the readability of the program. It also reduces number of comparisons in a program and thereby makes the program run faster.
A. Overloading
B. Function overriding
C. Polymorphism
D. Encapsulation
Method overriding or function overriding occurs has the same name and same signature in both the base and derived class.
A. Methods
B. Source codes
C. Segments
D. Overloaded functions
A function is a collection of statements grouped together. The methods or functions are the main building blocks of a program.
A. Program
B. Segment
C. Function
D. Function overloading
A function is a collection of statements grouped together. The methods or functions are the main building blocks of a program.
Method/function overriding
Binding refers to the linking of a procedure call to the code to be executed in response to the call.
A function is a collection of statements that is grouped together to perform an operation.
Late Binding or Dynamic Binding
Function overloading is the process of using the same name for two or more functions.
All default arguments must be the rightmost arguments. The following program works fine and produces 10 as output.
#include
using namespace std;
int fun(int x, int y = 0, int z = 0)
{ return (x + y + z); }
int main()
{
cout << fun(10);
return 0;
}
When the same function name has different definitions, it is known as function overloading. The definitions differ in the number and data types of the arguments.
Note:
The overloaded functions must have different arguments lists. Overloading functions with the same argument list but different return type is not allowed. Member functions cannot be overloaded by making one static and the other not, arguments being the same. There should be no ambiguity.
// overloaded functions
#include
int sum (int a, int b)
{
return a+b;
}
double sum (double a, double b)
{
return a+b;
}
int main ()
{
cout << sum (10,20) <<“n”;
cout << sum (1.0,1.5) <<“n”;
return 0;
}
When a function name is declared more than once in a program, the compiler interprets the declaration in following manner:
A. intersection compatibility.
B. projection compatibility.
C. union compatibility.
D. selection compatibility.
The union compatibility is defined as such :
(1) the two relations have the same degree n (number of attributes) ,
A. data integrity.
B. functional dependency.
C. referential integrity.
D. data independence.
Data independence is the type of data transparency that matters for a centralized DBMS. It refers to the immunity of user applications to make changes in the definition and organization of data, and vice-versa.
A. foreign key constraint.
B. check constraint.
C. table constraint.
D. unique key constraint.
A check constraint is the most generic constraint type. The value in certain column should satisfy a truth-value expression. There is no limit to the number of check constraints that one can define on a column.
A. terabytes.
B. megabytes.
C. gigabytes.
D. databytes.
The size of database is measured in gigabytes. Gigabyte is a multiple of the unit byte for digital information storage. Since the giga prefix means 109, gigabyte means 1,000,000,000 bytes (10003, 109).
A. logical data independence.
B. view modification.
C. conceptual modification.
D. physical data independence.
The logical data independence ensures that the application program remains the same. Modifications at the conceptual level are necessary whenever a logical structure of the data gets altered.
A. logical modification.
B. physical data independence.
C. physical modification.
D. logical data independence.
In physical data independence, the application programs remain the same even though the scheme at physical level gets modified. This is done in order to improve the performance of the system.
A. integrity is not maintained.
B. hardware configuration cost is high.
C. data redundancy is increased.
D. durability decreases.
Cost of hardware is one of the most important things for a database system. Its hardware configuration cost is high.
A. database administrator.
B. end user.
C. security officer.
D. programmer.
DBA is a person who checks the authenticity of the database. He insures the database is secure and functioning properly.
A. alter.
B. drop.
C. delete.
D. insert into.
DROP TABLE table_name; is the command used to remove the table.We should not get confuse with delete command, as delete is use to delete some rows.
A. intersection.
B. add.
C. join.
D. projection.
In the simplest form the join operation is just the cross product of two relations. Two interrelated tuples from two different relations are joined by this function.
A. 1NF.
B. 2NF.
C. 3NF.
D. 4NF.
A table is said to be in 3NF, if it is in 2NF and transitively dependency is removed from the table.
A. 1NF.
B. 2NF.
C. 3NF.
D. 5NF.
A table is said to be in 2NF, if it is in 1NF and all non-key attributes are totally dependent upon primary key.
A. 1NF.
B. 2NF.
C. 3NF.
D. 5NF.
1NF is used to remove the redundancy in the system. Therefore, delicacy and repetition of values is not allowed.
A. a referential integrity.
B. an entity integrity.
C. a data integrity.
D. a null integrity.
Primary key is a key, which uniquely identifies, a specific instance of an entity. Therefore, the value of the primary key can never be null.
A. DML.
B. DDL.
C. DCL.
D. TCL.
DDL stands for data definition language. It provides statement for creating and deleting the database.
Elements of an array can be accessed and processed in any order.
In a stack, data can be inserted (push) and deleted (pop) at one end, called the top. These are the only operations possible in a stack. Stack is a LIFO structure where the element that comes last must be removed first.
1. SET X = Start
2. REPEAT STEPS 3 to 4 UNTIL X = NULL
3. X->info = X->info + NUM
4. X = X->next
5. END
When the stack is implemented as an array, there is a limited size beyond which it cannot store elements. Trying to push when the stack is full would give an error ‘Overflow’. In case of linked implementation, whenever an element is to be stored a new node is created in memory.
1. SET X = Start
2. SET num = 0
3. REPEAT STEPS 4 to 6 UNTIL X = NULL
4. IF X->info !=0 THEN
5. num = num + 1
6. X = X->next
7. PRINT “Number of Non Zero values”, num
8. END
1. SET X = Start
2. SET P = NULL
3. REPEAT STEPS 4 to 7 UNTIL X = NULL
4. IF EL = X->info THEN
5. {P = X
6. Go To 8 }
7. X = X->next
8. IF P = NULL THEN
PRINT “Not Found”
ELSE
PRINT “Found At “, P
9. END
Queue is a FIFO (First In First Out) structure. This means that elements that enter the queue first, leave it first. All insertions are at the rear end and deletions are at the front end. The value of front and rear are maintained to keep track of these operations.
A queue can be visualized as queue of people waiting to buy a ticket. A queue can be implemented as an array or a linked list.
Overflow is a situation that occurs when we try to insert a value in an array when there is no space available. This situation is faced in stacks or queues. Once the available space is occupied or full, any attempt to push or insert, arises the ‘Overflow’ condition.
Underflow occurs when we try to extract or remove a value when there are none. Any attempt to extract from an empty list in stack or queue, implemented as array, arises ‘Underflow’ condition.