PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

Similar documents
Question Paper Code : 97044

SARDAR RAJA COLLEGE OF ENGINEERING

Table of Contents. Chapter 1: Introduction to Data Structures... 1

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24

VALLIAMMAI ENGINEERING COLLEGE

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur

DYNAMIC MEMORY ALLOCATION AND DEALLOCATION

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis

Tribhuvan University Institute of Science and Technology Computer Science and Information Technology (CSC. 154) Section A Attempt any Two questions:

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned.

ASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n))

OBJECT ORIENTED DATA STRUCTURE & ALGORITHMS

DATA STRUCTURES THROUGH C++

QUESTION BANK. Prepared by,mrs.d.maladhy AP/IT,RGCET. Page 1

Reg. No. : Question Paper Code : 27157

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

WITH C+ + William Ford University of the Pacific. William Topp University of the Pacific. Prentice Hall, Englewood Cliffs, New Jersey 07632

Course Review for Finals. Cpt S 223 Fall 2008

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DEPARTMENT OF COMPUTER APPLICATIONS B.C.A. - FIRST YEAR ( REGULATION) SECOND SEMESTER LESSON PLAN SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

Total No. of Questions :09] [Total No. of Pages : 02. II/IV B.Tech. DEGREE EXAMINATIONS, NOV/DEC First Semester CSE/IT DATA STRUCTURES USING C

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

Cpt S 122 Data Structures. Course Review FINAL. Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE0301. Subject Name: Data Structure. B.Tech. Year - II

LESSON PLAN B.C.A. - FIRST YEAR ( REGULATION) SECOND SEMESTER

CS301 - Data Structures Glossary By

& ( D. " mnp ' ( ) n 3. n 2. ( ) C. " n

Data Structures in C++ Using the Standard Template Library

Department of Computer Science and Technology

INSTITUTE OF AERONAUTICAL ENGINEERING

AP Computer Science 4325

CS 445: Data Structures Final Examination: Study Guide

GUJARAT TECHNOLOGICAL UNIVERSITY COMPUTER ENGINEERING (07) / INFORMATION TECHNOLOGY (16) / INFORMATION & COMMUNICATION TECHNOLOGY (32) DATA STRUCTURES

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

( ) + n. ( ) = n "1) + n. ( ) = T n 2. ( ) = 2T n 2. ( ) = T( n 2 ) +1

Data Structures Question Bank Multiple Choice

Code No: R Set No. 1

Note: Select one full question from each unit

Data Structures and Algorithm Analysis in C++

UCS-406 (Data Structure) Lab Assignment-1 (2 weeks)

M.C.A DEGREE EXAMINATION,NOVEMBER/DECEMBER 2010 Second Semester MC 9222-OBJECT ORIENTED PROGRAMMING (Regulation 2009)

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY THIRD SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 CS205: DATA STRUCTURES (CS, IT)

Chapter 1 Introduction

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance

9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.)

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours

DS ata Structures Aptitude

SAURASHTRA UNIVERSITY


BRONX COMMUNITY COLLEGE of the City University of New York DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE. Sample Final Exam

Data Structures Through C. Student Workbook

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

( ). Which of ( ) ( ) " #& ( ) " # g( n) ( ) " # f ( n) Test 1

VALLIAMMAI ENGINEERING COLLEGE

Visit ::: Original Website For Placement Papers. ::: Data Structure

Draw a diagram of an empty circular queue and describe it to the reader.

( D. Θ n. ( ) f n ( ) D. Ο%

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n)

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018

Computer Science E-22 Practice Final Exam

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1

Algorithm Class. C C++ DS JAVA DATA STRUCTURES TRAINING INSTITUTE KPHB HYDERABAD. Mobile:

About this exam review

Total No. of Questions : 18] [Total No. of Pages : 02. M.Sc. DEGREE EXAMINATION, DEC First Year COMPUTER SCIENCE.

( ) n 3. n 2 ( ) D. Ο

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

CS8391-DATA STRUCTURES

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each

1. Attempt any three of the following: 15

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D.

( ) ( ) C. " 1 n. ( ) $ f n. ( ) B. " log( n! ) ( ) and that you already know ( ) ( ) " % g( n) ( ) " #&

( ) D. Θ ( ) ( ) Ο f ( n) ( ) Ω. C. T n C. Θ. B. n logn Ο

Computer Science 302 Spring 2017 (Practice for) Final Examination, May 10, 2017

Algorithms and programs, basic idea of pseudo-code.algorithm efficiency and analysis, time and space analysis of algorithms order notations.

Name: 1 stack<int> s; 2 s.push(9) 3 s.push(5) 4 s.push(10) 5 s.push(1) 6 s.pop() 7 s.pop() 8 s.push(0) 9 s.pop() 10 s.pop() 11 s.

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

( ) 1 B. 1. Suppose f x

DATA STRUCTURES AND ALGORITHMS

CS 8391 DATA STRUCTURES

17CS33:Data Structures Using C QUESTION BANK

PESIT Bangalore South Campus Department of MCA Course Information for

University of Illinois at Urbana-Champaign Department of Computer Science. Final Examination

Data Structures. 1. Each entry in a linked list is a called a (a)link (b)node (c)data structure (d)none of the above

CLASSIC DATA STRUCTURES IN JAVA

12 Abstract Data Types

) $ f ( n) " %( g( n)

CS2013 Course Syllabus Spring 2018 Lecture: Mon/Wed 2:00 P.M. 2:50 P.M. SH C259 Lab: Mon/Wed 2:50 P.M. 4:00 P.M. SH C259

Sample Question Paper

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Computer Science 302 Fall 2009 (Practice) Second Examination, October 15, 2009

Transcription:

B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2009 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED Time: Three hours PROGRAMMING IN C++ Answer ALL questions Maximum: 100 Marks 1. When do we declare a member of a class static? 2. Why is it necessary to overload an operator? 3. What is an abstract class? 4. What does this pointer point to? 5. What is deque? 6. What is a heap and mention its types? 7. What is AVL Tree? 8. When does a graph become tree? 9. What is the worst case and best case time complexity of binary tree sort? 10. What is indexed sequential search? PART B (5 16 = 80 Marks) 11. (a) (i). What is a friend function? What are the merits and demerits of using friend function? (8) (ii) Define a class string. Use overload == operator to compare two strings. (8) (b) (i) What is a parameterized constructor? Explain with example. (8) (ii) What is a conversion function? How is it created? Explain its syntax. (8)

12. (a) (i) Describe the syntax of multiple inheritance. When do we use such an Inheritance? (10) (ii) What is a virtual function? When do we make a virtual function pure? (6) (b) (i) What is a file mode? Describe the various file mode options available. (8) (ii) What is an exception? How is an exception handled in C++? (8) 13. (a) (i) Define double linked list. Explain the various operations of double linked list with algorithm. (16) (b) (i) What is hashing? Explain the various hash functions with example. (10) (ii) What is Priority queue? Discuss the array implementation of priority queue. (6) 14. (a) Discuss the different methods of traversing a binary tree with algorithm. (16) (b) Discuss Prim s and Kruskal s algorithm for computing the minimal spanning tree weighted undirected graph. (16) 15. (a) (i) Write a C program to implement binary search and compute its complexity.(8) (ii) Compare the worst case and best case time complexity of various sorting techniques. (8) (b) Explain the all pairs shortest path algorithm with an example. (16)

B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2010 EC2202 DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C ++ Time: Three hours Maximum: 100 Marks Answer ALL Questions 1. How is a class declared in C++? 2. What is a scope resolution operator and how can it be used for global variable? 3. What is meant by binding? 4. How the pointer is implemented in C++? 5. Write any two data structures used in Operating System? 6. What are the representations of Big and small O notations? 7. How many trees are possible with 3 nodes? 8. What is a spanning tree? 9. What is the feature of bucket sort algorithm? 10. Define dynamic programming. PART B (5 16 = 80 Marks) 11. (a) (i) Give the syntax and usage of the reserved word inline with two examples. (8) (ii) Explain the importance of constructors and destructors with example. (8) (b) What is operator overloading? Overload the numerical operators +and / for complex numbers addition and division respectively. (16) 12. (a) (i) Define friend class and specify its importance. Explain with suitable example. (8) (ii) Discuss Virtual function and polymorphism with example. (8) (b) (i) Explain the concept of inheritance by considering an example of vehicle. (8) (ii) Explain the operators used for dynamic memory allocation with examples. (8) 13. (a) (i) Explain Priority Queues and how are binary heaps used in that. (8) (ii) Explain the properties of heap. (8)

(b) (i) Write a C ++ program to implement Stack and its operations PUSH and POP. (10) (ii) What is hashing? Classify hashing functions based on the various methods. (6) 14. (a) (i) Traverse the tree given below using Inorder, Preorder and Postorder traversals. (10) (ii) Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and postfix notations. (6) (b) (i) Convert the given graph with weighted edges to minimal spanning tree. (10) (ii) Write a short note on AVL trees. (6) 15. (a) Explain the algorithm of Quicksort by sorting the following set of numbers as an example: 42 47 52 57 62 37 32 27 22 (b) Describe divide and conquer technique with the help of mergesort. (16)

B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2010 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++ Time : Three hours Maximum : 100 Marks Answer ALL questions 1. What effects do the visibility labels private, protected and public have on the members of a class? 2. What are the advantages of operator overloading? 3. What is inheritance? What are its advantages? 4. Define virtual function. 5. Define stack. Mention the operations on stack. 6. What is binary heap? What are its types? 7. What is meant by an adjacency matrix? 8. State the properties of binary search tree. 9. What is sorting? How is sorting essential for data base applications? 10. What is meant by dynamic programming? PART B (5 16 = 80 Marks) 11. (a) (i) Compare and contrast Structured Programming and Object iented Programming. (8) (ii) Distinguish between Data Encapsulation and Data Abstraction. (4) (iii) Mention the purpose of Constructor and Destructor functions. (4) (b) (i) Explain the control structures of C++ with suitable examples. (12) (ii) Define function overloading with a simple example. (4) 12. (a) (i) Differentiate inheritance from polymorphism. (6) (ii) Write a C++ program to illustrate the concept of hierarchical inheritance. (10) (b) (i) What is the use of template? Write an overloaded function template called max( ), which will find the maximum of any two given integers. (8) (ii) Explain the exception handling mechanism of C++ in detail. (8)

13. (a) (i) Explain the operations performed on queue in detail. Write a C++ program to implement these queue operations. (10) (ii) Explain insertion, deletion and replacement of nodes in a heap. (6) (b) (i) What are the advantages of linked list over array? (4) (ii) Define Hashing. (2) (iii) Write a C++ program to implement stack through linked list. (10) 14. (a) (i) Write an algorithm to traverse binary tree level by level, with each level of the tree being traversed from left to right. (10) (ii) Explain spanning tree and minimal spanning tree with examples. (6) (b) (i) Define AVL tree. Explain the operations on AVL tree with illustrations. (6) (ii) Explain breadth first search algorithm for the traversal of any graph with suitable examples. Define time complexity of the algorithm. (10) 15. (a) (i) Explain heap sort with an illustration. (8) (ii) Explain the greedy algorithm to find minimum spanning tree. (8) (b) (i) Explain the insertion sort with its time complexity. (8) (ii) Explain as to how divide and conquer technique can be applied for merge sort. (8)

B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++ Time: Three hours Maximum: 100 Marks Answer ALL questions. 1. What are the advantages of using new operator as compared to malloc () function? 2. Give the syntax of Operator function. 3. State the difference between char * const ptr and char const * ptr. 4. List out the modes in which the files can be opened. 5. What is the advantage of doubly linked list over single linked list? 6. What is meant by collision in hashing? 7. When a binary tree does become binary search tree? 8. Define minimum spanning tree. 9. Which is the fastest sorting algorithm in practice? What is the average and worst case running time of it? 10. Give the working method of Divide and Conquer in two simple steps. PART B (5 16 = 80 Marks) 11. (a) (i) Explain the concept of passing by reference using reference variables. (6) (ii) Write a C++ program to assign n projects to m programmers based on the skill set of programmers using friend function. Use static variable to count total number of assignments. (10) 11. (b) (i) Define Copy constructor and Dynamic constructor. What are the different ways of writing copy constructor? (6) (ii) Write a note on constructors and destructors. (10) 12. (a) Write a C++ program to define a class called patient (name, age, sex). Derive two classes from patient namely in-patient (ipno, date-of-adm, date-ofdischarge) and out-patient (opno, doctor-id, and consultation-fee). Define two classes namely general-ward (rent/day) and special-ward (roomno, rent/day, ebbill). For out-patient print the bill with consultation-fee. For in-patients, print bill According to their accommodation either in general-ward or special-ward. (16) (b) (i) Write a program to maintain employee details using files. Arrange the file in descending order of their salary. (8) (ii) What is called pure virtual function? (3) (iii) Explain the concept of multiple catch statements in exception handling.(5)

13. (a) (i) Describe general rules to be considered while calculating time complexity of an algorithm. (6) (ii) Write an algorithm to insert an element into a stack and a queue. Can stack be used for recursion? Justify your answer. (10) (b) (i) Explain basic Heap operations and some of specialized operations with examples. (8) (ii) Give the algorithm for inserting an element and deleting an element in a linked list. (8) 14. (a) What is an AVL tree? What are the different case issues when an element is inserted into an AVL tree? How to solve those issues? (16) (b) (i) Write down the Dijkstra s algorithm and explain it with example. (8) (ii) Consider the following diagram. Using Prim s algorithm and Kruskal s algorithm draw all the intermediate stages of the graph to find minimum spanning tree. (8) 10 A 7 G 1 4 B 2 6 5 C 6 E 8 6 2 D 3 F 9 15. (a) (i) Give the algorithm for insertion sort. (8) (ii) Illustrate the intermediate steps of heap tree using heap sort for the given set of numbers. (8) 67, 3, 24, 45, 9, 12, 30, 29, 90. (b) (i) How do the Greedy algorithms work? (5) (ii) Write the algorithm for All-pairs shortest path and explain it with an example. (11)

B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++ Time: Three hours Maximum: 100 Marks Answer ALL questions. 1. What is the significance of contour structures? 2. List the type conversions present in C++. 3. What is polymorphism? 4. How are file handling templates useful in programming? 5. How is data stored in QUEUE structure? 6. Insertion sort is faster than bubble sort. Justify this statement. 7. Differentiate between trees and graphs. 8. Does the minimum spanning tree of the graph give the shortest didtance between any two specified nodes? When it is possible? 9. Compare and contrast greedy method and dynamic programming. 10. Which data structure is suitable for implementing backtracking? PART B (5 16 = 80 Marks) 11. (a) (i) Explain the functions of C++ with suitable examples. (8) (ii) Explain about contour structures. (8) (b) (i) Explain the type conversions present in C++. (8) (ii) Write a note on constructors and destructors. (8) 12. (a) (i) Write a program to explain the significance of pointers in C++. (8) (ii)explain about virtual functions. (8) (b) (i) Explain about file handling templates. (8) (ii) Illustrate Exception handling with an example in C++. (8) 13. (a) (i) Explain the operations performed by stack in detail. Write a C++ program to implement these operations. (8) (ii) Write a program to insert a node using heap. (8) (b) (i) Design an algorithm to split a circular list into two circular lists. (8) (ii) Formulate an algorithm to create an ordered linear list with no duplicate terms. The input is a polynomial with three variables that is unordered and has repeated terms. (8) 14. (a) (i) Explain with illustration the various types of rotations needed to retain the properties of an AVL tree during insertions of a node. State the time complexity of insertion of a node into an AVL. (8)

(ii) Draw the result of inserting 20, 10, and 24 one by one into the AVL tree given below. Draw the tree after each insertion. (8) 53 25 72 12 38 64 83 7 19 58 75 14. (b) Consider the following graph G. The label of an edge is the cost of the edge. 30 a 40 b 30 c 20 10 30 40 e 20 f d 50 (i) Give the representation of the graph G in a computer. What is the space complexity? (8) (ii) Using kruskals algorithm, draw a minimum spanning tree (MST) of the graph G describing each step of the algorithm. Also write down the order in which the edges are selected. (8) 15. (a) (i) Explain the algorithm and program of selection sort. (8) (ii) Write short notes about heap sorting. (8) (b) Consider the array Heap = [ 3,5,6,7,20,8,2,9,12,15,30,17]. Consider an empty heap. Construct a MAX HEAP while inserting these values one by one. Display the heap after each insertion. Show the result in array format. Now insert elements 15, 20 and 45 using the bubbling up process. Show the max heap following each insert.

B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2012 EC 2202 DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++ Time: Three hours Answer ALL questions. Maximum: 100 Marks 1. Define object. 2. What is constructor? 3. List out the operators which cannot be overloaded. 4. What does multiple inheritance mean? 5. What are the basic data structures available in C++? 6. Define heap. 7. When the tree is called Complete binary tree? 8. Define ADT. 9. Define spanning tree. 10. What is the worst case and best case no. of comparisons in a linear search? PART B (5 x 16 = 80 marks) 11. (a) Write a menu-driven program to accept 2 integers and an operator (+,-,*, %,/) and to perform the operation and print the result. (b) Specify a class called complex to represent complex numbers. Overload +, - and * operators when working on the objects of this class. 12. (a) Define Friend Function. What is polymorphism? Explain multiple inheritance. (b) What is string? Write a C++ Program to sort the given strings in the alphabetically. 13. (a) Explain the operations of Binary heap. (b) Write algorithms for insertion and deletion in linked stack. 14. (a) Describe the shortest path identification using dijkstra s algorithm. (b) What is graph? Explain the depth first search tree. 15. (a) Describe the concept of Bubble Sort & Merge sort with example. (b) With example explain the binary search technique.