.... How to Find Your Subject Study Group & Join ....   .... Find Your Subject Study Group & Join ....  

We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Study Groups By Subject code Wise (Click Below on your university link & Join Your Subject Group)

[ + VU Study Groups Subject Code Wise ]  [ + COMSATS Virtual Campus Study Groups Subject Code Wise ]

Looking For Something at vustudents.ning.com?Search Here

Hey  guyz,

I tried toOo solve the papers awl my attentions ..if you find any mistake then mention it.

Share This With Friends......


How to Find Your Subject Study Group & Join.

Find Your Subject Study Group & Join.

+ Click Here To Join also Our facebook study Group.


This Content Originally Published by a member of VU Students.

+ Prohibited Content On Site + Report a violation + Report an Issue


Views: 739

See Your Saved Posts Timeline

Attachments:

Replies to This Discussion

Note: (This is Featured Discussion)

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

CS301_Data_Structures_Solved_MCQs_from_Quiz

Attachments:

CS301 Solved Current paper

MCQ’s was from past papers

What is the difference between call by value and call by reference? 2

Answer:

Call by value:

In case of call by value, a copy of object is made and placed at

the time of function calling in the activation record. Here the copy constructor is used

to make a copy of the object. If we don’t want the function to change the parameter

Without going for the use of time, memory creating and storing an entire copy of, it is

Advisable to use the reference parameter as const.

Call by reference:

By using the references, we are not making the copy. Moreover, with the const keyword, the function cannot change the object. The calling function has read only access to this object. It can use this object in the computation but can not change it.

 

What is a pre-order traversal? 2

Answer:

The first of these three is (N, L, R), also called as preorder traversal. In preorder traversal the root node comes first then left sub trees node and right sub trees occur.

 

Redraw the given tree and write balance of it. 2

Chapter : 19 Page no 207

A code was given and we have to tell what the recursive function is doing. 3

Page : 149 

Chapter : 14

 

10 integer values was given and we have to draw a binary search tree. Then delete a node 65 from it and redraw the tree. 5

68  63 65 89 52 66 54 35 69 56 --àI suppose numbers

 

SOLUTION:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Deleted.. 65

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Values were given and we have to draw AVL tree after balancing it. 5

Chapter : 19 page no 207

i)        Queue is a linear data structure. Discuss

A queue is a linear data structure into which items can only be inserted at one end and

removed from the other. In contrast to the stack, which is a LIFO (Last In First Out)

structure, a queue is a FIFO (First In First Out) structure.

ii)      AVL Rotation

Page no 220 +221  chapter no 20

 

iii)    Insert 12  in following AVL tree

Page no :219  chapter no 20

 

 

Subject: My cs 301 paper

------------
(My todays paper CS301 data structure)

Short questions:

Write transversal types of BST.

ANS: Preorder, in order and post order traversal


How can dangling reference problem be avoided?

ANS:

To avoid dangling reference, don’t return the reference of a local variable

(transient) from a function.


Draw complete binary tree containing four nodes and three levels.

Chapter no 11 page no 123

 

Unable to draw.

The numbers of nodes at level three should be four.

 

 

 

 

 

 

 

 

 

 

 

 

 

 


What is the output of the following program?

#include

#include

Int valMinus3(intOrgval)

Answer:

E Type& findMin( ) const;

This method is used to find the minimum data value in the binary tree.

This will find minmum number 3 in binary tree.
What is the output of the following program?

#include

#include

Int valMinus1(intOrgval)

Answer:
This will find minmum number 1 in binary tree.

 

 

100,70,110,60,80,50,120,150,85,87

 

 

 

 

 

 

 

 

 

 

 

 

 

  1. 2. provide AVL finaly for the following inorder and post order elements
  2. Inorder :- LCADFZ
  3.  Post order :- LCDZFA

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

20 MCQS, 2 questions= 2, 2 marks, 2 questions = 3, 3 marks, 2 questions = 5,5 marks mostly mcqs from past papers ( jis main reference bhi diya howa hai mcqs ka).

SUbjective portion :

Q: height of a tree, balance of a node (3 marks)

Q: how we degenerate a binary search tree? (3 marks)

We degenerate a binary search tree after balancing it. This new tree is purposed to say AVL tree which has the same attributes a binary search tree only 2 different points

1)      The height of left subtree and right sub trees is at most 1

2)      The height of empty sub tree is (-1).

In AVL tree the balance of nodes should be 0,1,-1

Q: binary search tree given tha aur mjy (i) post order (ii) level order batana tha bss (5 marks)

Q: aur aik question tha k values guven thee tau uski diagram banani thee AVL tree main just diagram like values 10,13,16,17,60,70,80,90,95,97 etc

 

 

 

 

 

 

Q: delete a node leaf in a tree ,, then in BST how many pointers are used to NULL it?? is tarha kar k kuch question tha (2 marks)

The pointer passed to the function is pointing  To NULL. In case it is NULL, there is no node to traverse and the method will return

 

 

Q: aur aik question aisa tha jis main diargram given thee aur batan tha k yeh konsa tree hai for example simple tree, binary tree, bst, AVL, strictly binary tree etc aur issi ka aik part aur tha k nodes bhi batani thee k total nodes kitni use ho rahi hain diagram main okay 2 marks ( 1 for tree name and 1 for total nodes?? clear ho gaya sab ok enjoy karo 

CQs were from past papers almost 70%. 2 marks questions are:

How we can delete a node having two childs?

This is Case no three of deletion . If we have two childs then we will find out the inorder successor of that parent node that is to be deleted in the right subtree and link it to that parent node then the node will be deleted and inorder successor will take the place of that node.

Suppose x and y are int variable then write two statements which show two reference variables a and b referencing x and y.

Int & A=x;

Int& B= y;

program tha bnene ko

write the details of given statements.
(a). int x;
int * y = & x;

Here y is a pointer  to the reference variable x that referred to y pointer itself these are not the actual objects themselves
(b). int x;
int &y = x;

The y is reference variable  referencing to the x.
(c). int x;
int y = x;

The value of y will be equal to x.


How to calculate height of tree

 

Construct binary tree with values 39,20,22,33,16,35,18 and then delete 22

Delete node from bst

Benefit and syntax of reference

The syntax we are using here is C++ specific, like we are sending a parameter by  pointer using & sign. By using the references, we are not making the copy. Moreover, with the const keyword, the function cannot change the object. The calling function has read only access to this object. It can use this object in the computation but can not change it.

int x;
int &y = x;

My today paper of cs301

Q1: Describe main disadvantage of AVL tree?

For making it a balanced one, we have to carry  the heigh  computations. While dealing with AVL trees, we have to keep the information of balance factor of the nodes along with the data of nodes.

Q2: Describe only two cases of deletion of nodes in the BST?

Q3: Briefly explain following..Reference variable, const keyword and Dangling Reference?

Answer: (Page 198)

Const keyword

The const keyword is used for something to be constant. The actual meanings depend on where it occurs but it

generally means something is to held constant. There can be constant functions, constant variables or parameters

etc.

Reference variable

The references are pointers internally, actually they are constant pointers. You cannot perform any kind of

arithmetic manipulation with references that you normally do with pointers.

Dangling reference

The pointer of the object (when object has already been deallocated or released) is called dangling pointer.

Q4:Draw complete tree of five nodes?

 

.

 

 

Q5: Construct a tree of 15,17,18,21,23,25,31 nodes

 

 

 

Q6: Tree was given and we have to write its traversal methods pre and post order

Which cases of insertion in AVL require double rotations to make tree balance?

An insertion into right subtree of the left child of D.

An insertion into left subtree of the right child of D.

 

 

 

 ๑♥ AquaLeo♥๑ thanks for sharing 

CS301 Solved Current paper

MCQ’s was from past papers

What is the difference between call by value and call by reference? 2

Answer:

Call by value:

In case of call by value, a copy of object is made and placed at

the time of function calling in the activation record. Here the copy constructor is used

to make a copy of the object. If we don’t want the function to change the parameter

Without going for the use of time, memory creating and storing an entire copy of, it is

Advisable to use the reference parameter as const.

Call by reference:

By using the references, we are not making the copy. Moreover, with the const keyword, the function cannot change the object. The calling function has read only access to this object. It can use this object in the computation but can not change it.

 

What is a pre-order traversal? 2

Answer:

 (L, N, R)

(N, L, R)

,N)(R, L

(L, R, N)

(N, R, L)

(R, N, L)

When We select the following three permutations from the

above six. The first of these three is (N, L, R), also called as preorder traversal

 

Redraw the given tree and write balance of it. 2

Chapter : 19 Page no 207

A code was given and we have to tell what the recursive function is doing. 3

Page : 149 

Chapter : 14

 

10 integer values was given and we have to draw a binary search tree. Then delete a node 65 from it and redraw the tree. 5

Chapter : 12

Values were given and we have to draw AVL tree after balancing it. 5

Chapter : 19 page no 207

i)        Queue is a linear data structure. Discuss

A queue is a linear data structure into which items can only be inserted at one end and

removed from the other. In contrast to the stack, which is a LIFO (Last In First Out)

structure, a queue is a FIFO (First In First Out) structure.

ii)      AVL Rotation

Page no 220 +221  chapter no 20

 

iii)    Insert 12  in following AVL tree

Page no :219  chapter no 20

 

 

Subject: My cs 301 paper

------------
(My todays paper CS301 data structure)

Short questions:

Write transversal types of BST.

ANS: Preorder, in order and post order traversal


How can dangling reference problem be avoided?

ANS:

To avoid dangling reference, don’t return the reference of a local variable

(transient) from a function.


Draw complete binary tree containing four nodes and three levels.

Chapter no 11 page no 122


What is the output of the following program?

#include

#include

Int valMinus3(intOrgval)

Answer:

 Type& findMin( ) const;

This method is used to find the minimum data value in the binary tree.

This will found 3 in binary tree

What is the output of the following program?

#include

#include

Int valMinus1(intOrgval)

Answer:
This will found 1 in binary tree.

Your WElCome... ! becz i think it will be more .. effective if i shared .. my file by my own... other then anyone else post them with their names... any how THnkx For Encouragement!

Thank you very much

strngly WElcOmed!

RSS

Forum Categorizes

Job's & Careers (Latest Jobs)

Admissions (Latest Admissons)

Scholarship (Latest Scholarships)

Internship (Latest Internships)

VU Study

Other Universities/Colleges/Schools Help

    ::::::::::: More Categorizes :::::::::::

Member of The Month

1. Angry Bird

Lahore, Pakistan

© 2018   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service