Tuesday , 3 December 2024

CS301 Solved Mid Term Papers by Arslan Ali and Zeeshan

Question No: 1      ( Marks: 1 ) – Please choose one

In the statement int x[6]; , we cannot assign any value to x because x is not an lvalue. 

       ► True

       ► False 

Question No: 2      ( Marks: 1 ) – Please choose one

What will be postfix expression of the following infix expression?

Infix Expression : a+b*c-d 

       ► ab+c*d- 

       ► abc*+d-

       ► abc+*d- 

       ► abcd+*- 

Question No: 3      ( Marks: 1 ) – Please choose one

Which one of the following calling methods does not change the original value of the argument in the calling function?  

       ► None of the given options 

       ► Call by passing the value of the argument 

       ► Call by passing reference of the argument 

       ► Call by passing the address of the argument 

Question No: 4      ( Marks: 1 ) – Please choose one

In a program a reference variable, say x, can be declared as  

       ►  int &x ;  

       ►  int *x ; 

       ►  int x ;  

       ► None of the given options

Question No: 5      ( Marks: 1 ) – Please choose one


A tree is an AVL tree if  

       ► Any one node fulfills the AVL condition  

       ► At least half of the nodes fulfill the AVL condition 

       ► All the nodes fulfill the AVL condition  

       ► None of the given options 

Question No: 6      ( Marks: 1 ) – Please choose one

Consider the following pseudo code                                                                                               

declare a stack of characters
while ( there are more characters in the word to read )
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
pop a character off the stack
write the character to the screen
}
What is written to the screen for the input “apples”?

 

       ► selpa 

       ► selppa 

       ► apples 

       ► aaappppplleess 

Question No: 7      ( Marks: 1 ) – Please choose one

In the following C++ code, how many function calls are made? 

            int x, y, z;

            x = 2;

            y = 3 + x;

            z = foobar(x,y); 

       ► 1 

       ► 4 

       ► 7 

       ► 8 

Question No: 8      ( Marks: 1 ) – Please choose one

We can add elements in QUEUE From _________ 

       ► Front 

       ► Rear 

       ► From Both Rare and Front

       ► None of these 

Question No: 9      ( Marks: 1 ) – Please choose one

Consider the following tree.

1

How many of the nodes have at least one sibling? 

       ► 8 

       ► 7

       ► 5 

       ► 6 

Question No: 10      ( Marks: 1 ) – Please choose one

Consider the following tree.

2

How many descendants does the root have? 

       ► 5 

       ► 6 

       ► 7


       ► 8 

Question No: 11      ( Marks: 1 ) – Please choose one

Below is a binary search tree. If we delete the value 50 using the algorithm we discussed, what value will be in the root of the remaining tree? 

3

       ► 50 

       ► 60 

       ► 70 

       ► 80 

Question No: 12      ( Marks: 1 ) – Please choose one

We access elements in AVL Tree in, 

       ► Linear way only 

       ► Non Linear way only 

       ► Both linear and non linear ways 

       ► None of the given options. 

Question No: 13      ( Marks: 1 ) – Please choose one

Which of the following statement regarding binary tree is NOT correct. 

       ► A binary tree can contain at least 2L Nodes at level L. 

       ► A complete binary tree of depth d is a binary tree that contains 2L Nodes at each level L between 0 and d, both inclusive. 

       ► The total number of nodes (Tn ) in a complete binary tree of depth d is 2 d+1 – 1 . 

       ► The height of the complete binary tree can be written as h = log 2 (Tn+1)-1 where Tn is Total number of Nodes.

Question No: 14      ( Marks: 1 ) – Please choose one

The following are statements related to queues.

(i)   The last item to be added to a queue is the first item to be removed

(ii) A queue is a structure in which both ends are not used

(iii)  The last element hasn’t to wait until all elements preceding it on the queue are removed

(iv)  A queue is said to be a last-in-first-out list or LIFO data structure.

 

Which of the above is/are related to normal queues?

 

       ► (iii) and (ii) only 

       ► (i), (ii) and (iv) only 

       ► (ii) and (iv) only 

       ► None of the given options

 

 

 

Question No: 15      ( Marks: 1 ) – Please choose one

The________method of list data structure removes the element residing at the current position. 

       ► Add

       ► next 

       ► remove

       ► find 

Question No: 16      ( Marks: 1 ) – Please choose one

it will be efficient to place stack elements at the start of the list because insertion and removal take _______time.  

       ► Variable 

       ► Constant

       ► Inconsistent 

       ► None of the above

CS301 Solved Mid Term Paper Click here to Download

Check Also

CS301 unSolved Final Term papers Mega Colletionction by Arslan Ali

      FINALTERM  EXAMINATION Spring 2010 CS301- Data Structures Time: 90 min Marks: 58 …

Leave a Reply

Your email address will not be published. Required fields are marked *

*