RAJA COLLEGE OF ENGINEERING & TECHNOLOGY

Size: px
Start display at page:

Download "RAJA COLLEGE OF ENGINEERING & TECHNOLOGY"

Transcription

1 RAJA COLLEGE OF ENGINEERING & TECHNOLOGY (Affiliated to Anna University) Veerapanjan, Madurai DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING BACHELOR OF ENGINEERING THIRD SEMESTER CS6311 PROGRAMMING AND DATA STRUCTURE LABORATORY II LAB MANUAL (Regulation 2013)

2 CS6311 PROGRAMMING AND DATA STRUCTURE LABORATORY I I T P C OBJECTIVES: The student should be made to: - Down design. LIST OF EXPERIMENTS: IMPLEMENTATION IN THE FOLLOWING TOPICS: 1. Constructors & Destructors, Copy Constructor. 2. Friend Function & Friend Class. 3. Inheritance. 4. Polymorphism & Function Overloading. 5. Virtual Functions. 6. Overload Unary & Binary Operators Both as Member Function & Non Member Function. 7. Class Templates & Function Templates. 8. Exception Handling Mechanism. 9. Standard Template Library concept. 10. File Stream classes. 11. Applications of Stack and Queue 12. Binary Search Tree 13. Tree traversal Techniques 14. Minimum Spanning Trees 15. Shortest Path s OUTCOMES: At the end of the course, the student should be able to: TOTAL: 45 PERIODS graphs. ods for program development. LIST OF EQUIPMENT FOR A BATCH OF 30 STUDENTS: Standalone desktops with C++ complier 30 Nos. (or) Server with C++ compiler supporting 30 terminals or more.

3 CONTENTS Sl.No Ex.No. Title of the Experiments 1 1 Constructors Page No. 2 2 Destructors 3 3 Copy Constructor. 4 4 Friend Function 5 5 Friend Class 6 6 Inheritance 7 7 Function Overloading 8 8 Virtual Functions 9 9a Unary Operator Overloading Using Member function 10 9b Unary Operator Overloading Using Friend function 11 10a Binary Operators Overloading Using Member function 12 10b Binary Operators Overloading Using Friend function 13 11a Function Templates 14 11b Class Templates Exception Handling Mechanism Standard Template Library concept File Stream classes Application of Stack Applications of Queue Binary Search Tree & Tree traversal Techniques Minimum Spanning Trees Shortest Path s

4 Ex.No 1 CONSTRUCTOR To initialize data members of an object using copy constructor 2. Declare class distance containing data members inch and feet. 3. Define default constructor that initializes data members to Define parameterized constructor that initializes data members with values provided. 5. Define display function to print value of data members 6. Create distance objects to invoke the constructors. 7. Call display function for each distance object. 8. Stop class distance int feet; int inch; distance() distance (int n, int d = 0) ] void print() ; int main() 0.0ft 4.0ft 22.7ft

5 Ex.No 2 COPY CONSTRUCTOR To initialize data members of an object using copy constructor 2. Declare class complex with data members real and imag 3. Define parameterized constructor that initializes data members with given values 4. Define copy constructor that uses an object reference to initialize data members of another object 5. Define display function to print data members 6. Create complex objects that invoke copy constructor in various ways. 7. Call display function for each distance object. 8. Stop class complex int real; int imag; ; int main() complex(int r, int i) complex(const complex &c1) void display() 2 + 3i i

6 Ex.No 3 DESTRUCTOR To allocate memory for objects dynamically and release memory using destructor. 2. Declare class mystring with data member str and len 3. Define dynamic constructor using new operator 4. Define display function to print string contents 5. Define destructor that releases memory using delete operator 6. Create objects using constructor and invoke destructor when they go out of scope 7. Stop class mystring char *str; int len; mystring (char *s) void display() ~mystring() // Destructor ; int main() mystring s1("smkfit"); s1.display(); Dynamic memory allocation SMKFIT Memory released

7 Ex.No 4 FRIEND FUNCTION To access data members of a class using friend function. 2. Declare class sample with data members 3. Define a non-member function mean that returns aggregate of data members 4. Declare function mean as friend to class sample 5. Provide value for data members 6. Call function mean 7. Stop class sample int a; int b; void setvalue() friend float mean(sample s) int main() sample X; X.setvalue(); cout << "Mean value = " << mean(x) ; Mean value = 32.5

8 Ex.No 5 FRIEND CLASS5 To demonstrate usage of friend classes 2. Declare class rectangle with length and breadth as data members 3. Declare class square with side as data member 4. Declare class rectangle as friend to class square 5. Define function convert in rectangle class that takes square object as argument 6. Create objects for both classes 7. Call function convert to demonstrate friend class. 8. Stop class square; class rectangle int width; int height; int area () void convert (square a) ; ; class square friend class rectangle; int side; square (int a) ; int main() rectangle rect; square sqr(4); rect.convert(sqr); cout << "Rectangle area : " << rect.area(); return 0; Rectangle area: 16

9 Ex.No 6 SINGLE INHERITANCE To demonstrate single inheritance 2. Declare class rectangle with protected members length and breadth 3. Define function rectdim to read values 4. Derive class box from rectangle in public mode with data member depth. 5. Define function getdata for box class that calls rectdim function 6. Create object for box class 7. Display volume of the box. 8. Stop class rectangle protected: int length; int breadth; void rectdim() ; class box : public rectangle protected: int depth; void getdata() void display() ; int main() Enter length and breadth : 4 5 Enter depth : 6 Box area : 120

10 Ex.No 7 FUNCTION OVERLOADING To create a family of functions with same name to implement function polymorphism. 2. Declare prototypes for function area to compute area of various shapes. 3. Define area functions that varies on argument and implementation. 4. Call area function with corresponding arguments 5. Stop int area(int); int area(int, int); double area(double); area(int, double); double area(double, int); int area(int, int, int); // square // rectangle // circle double // triangle // equilateral triangle // trapezoid int main() cout << "\n Square area : " << area(5); cout << "\n Rectangle area : " << area(5,4); cout << "\n Circle area : " << (PI*area(4.6)); cout << "\n Triangle area : " << (0.5 * area(5, 6.2)); cout << "\n Equi. Triangle area : " << (0.5 * area(5.3, 6)); cout << "\n Trapezoid area : " << area(5, 6, 7); return 0; Square area : 25 Rectangle area : 20 Circle area : Triangle area : 15.5 Equi. Triangle area : 15.9 Trapezoid area : 210

11 Ex.No 8 VIRTUAL FUNCTION To design a simple hierarchical classification for vehicle class and demonstrate runtime polymorphism using virtual function. 2. Declare class vehicle with protected members capacity, fuel, feature and virtual function display 3. Derive class bicycle, autorickshaw and lorry from vehicle publicly. 4. Define default constructor for derived classes to initialize derived data members. 5. Redefine display function to print details for the corresponding vehicle 6. Create a vehicle class pointer and assign bicycle / autorickshaw / lorry object 7. Call display function to demonstrate runtime polymorphism 8. Stop #include <iostream.h> #include<conio.h> #include <string.h> class vehicle protected: int capacity; char fuel[30]; char feature[100]; virtual void display() = 0; ; class bicycle : public vehicle bicycle() capacity = 2; strcpy(fuel, "Air"); strcpy(feature, "Green environment"); void display() cout << "Bicycle \n"; cout << "Capacity : " << capacity << "\n"; cout << "Fuel : " << fuel << "\n"; cout << "Features : " << feature << "\n";

12 ; class autorikshaw : public vehicle autorikshaw() void display() ; class lorry : public vehicle lorry() void display() ; int main() vehicle *v1; v1 = new bicycle; v1- >display(); v1 = new autorikshaw; v1- >display(); v1 = new lorry; v1- >display(); return 0; Bicycle Capacity : 2 Fuel : Air Features : Green environment Autorickshaw Capacity : 3 Fuel : Petrol/Diesel/LPG Features : Urban transport Lorry Capacity : 2 Fuel : Diesel Features : Cargo transport

13 Ex.No 9a UNARY OPERATOR OVERLOADING - MEMBER FUNCTION To overload unary operator using member function. 2. Declare class space with data members x, y and z 3. Define parameterized constructor for space class 4. Define display function to print data members 5. Overload unary minus ( ) using operator member function 6. Create a space object 7. Invoke unary minus on space object 8. Call display member function. 9. Stop #include <iostream.h> #include <conio.h> class space int x; int y; int z; space(int a, int b, int c) void display() void operator-() ; int main() Original 3D coordinates : Negated 3D coordinates :

14 Ex.No: 9b UNARY OPERATOR OVERLOADING - FRIEND FUNCTION To overload unary operator ++ on fraction number using friend function 2. Declare class fraction with data members num and den 3. Define parameterized constructor for fraction class 4. Define display function to print data members 5. Declare operator function to overload ++ as friend to class fraction 6. Overload increment operator (++) as a non-member function 7. Create a fraction object 8. Invoke increment operator on fraction object 9. Call display member function. 10. Stop #include <iostream.h> #include<conio.h> class fraction int num; int den; fraction(int n, int d) void display() friend void operator ++(fraction &f) ; int main() fraction f1(22,7); Before increment : 22/7 After increment : 29/7

15 Ex.No: 10a. BINARY OPERATOR OVERLOADING - MEMBER FUNCTION To overload operator + to perform addition of two distance objects. 2. Declare class distance with data members inch and feet 3. Define default and parameterized constructor for distance class 4. Define display function to print data members 5. Overload operator + using operator member function Add feet values & store it into var f Add inch values & store it into var i If i>12.0 then decrement i by 12 & increment f by 1 Return f & i 6. Create two distance object with input values. 7. Sum the distance objects using overloaded + and store result in another distance object 8. Call display member function. 9. Stop Program #include <iostream.h> #include<conio.h> class distance int feet; int inch; distance() () distance (int f, int i) void display() distance operator +(distance d2) ; int main() Distance1 : 10.6ft Distance2 : 11.6ft Distance3 : 22.0ft

16 Ex.No:10b BINARY OPERATOR OVERLOADING FRIEND FUNCTION To create an array1d class and to overload operators + to perform addition of one dimensional array 2. Declare class array1d with data members arr containing an array 3. Define getdata function to obtain input for array elements 4. Define display function to print array elements 5. Declare overloading of operator + as friend to class Array 6. Overload operator + as a non-member function to perform scalar addition on array elements 7. Create Array objects. 8. Call getdata function for each object 9. Invoke the overloaded operator + Array objects 10. Call display member function. 11.Stop #include <iostream.h> #include<conio.h> class Array int arr[100]; void getdata() void display() friend Array operator + (Array x, Array y) ; int main() Enter 5 elements for B array : Enter 5 elements for C array : B+C =

17 Ex.No:11a FUNCTION TEMPLATE To perform bubble sort on an array using function templates. 2. Define function template arrange to implement bubble sort with array argument of template type 3. Declare different types of array containing unordered elements 4. Call arrange function for each array 5. Display array elements for each array 6. Stop #include <iostream.h> template <class T> // Template function void arrange(t arr[], int size) int main() Sorted Arrays Int Float Char I a d i n n

18 Ex.No: 11b CLASS TEMPLATES To implement stack operations push and pop using class template. 2. Declare a template class mystack with array data member st of template type 3. Define a default constructor that initializes top data member 4. Define push and pop operation with template arguments 5. Define function full and empty to indicate stack full or empty 6. Create mystack objects of different types. 7. Invoke stack operations for each mystack object 8. Stop Program #include <iostream.h> const int size = 5; template <class T> class mystack T st[size]; int top; mystack() void push(t var) T pop() int empty() int full() ; int main() mystack <char> s1; // Character Stack mystack <int>s2; // Integer stack Character Stack Pop : e d c b a Integer Stack Pop :

19 Ex.No: 12 EXCEPTION HANDLING To demonstrate exception handling in C++ using try, throw and catch mechanism. 2. Read two numbers a and b 3. Within try block, if b = 0 then raise exception for b 4. Otherwise execute arithmetic expression a / b 5. Define catch block to handle divide by zero exception 6. Stop Program #include <iostream.h> int main() try catch(int i) Enter values for A and B : 3 0 Divide by zero error for A/B

20 Ex. No: 13 STL VECTOR To demonstrate the functionality of sequence container STL vector class 2. Include header file vector 3. Create a vector object v1 to store integers. 4. Use push_back member function to append elements onto v1 5. Delete last element in v1 using pop_back member function 6. Display first and last element of v1 using front and back member function 7. Display length of v1 using size member function 8. Display v1 elements using a loop 9. Stop ProgramOutline #include <iostream> #include <vector> using namespace std; int main() vector <int> v1(5); // Vector of size cout << "Enter element to append : "; cin >> data; v1.push_back(data); // Add element dynamically cout << "Current size: " << v1.size() << "\n"; cout << "First element : " << v1.front() << "\n"; cout << "Last element : " << v1.back() << "\n"; v1.pop_back(); // Deleting last element

21 cout << "Size after pop : " << v1.size() << "\n"; cout << "Vector elements : "; - Enter 5 vector elements : Enter element to append : 2 Current size: 6 First element : 9 Last element : 2 Size after pop : 5 Vector elements :

22 Ex. No: 14 CHARACTER FILE I/O To write characters onto a file and to find number of vowels in it using character file Input/output operations. 2. Include header file fstream 3. Declare a file object fp 4. Open file sample.txt in output mode using open function 5. Fetch character-by-character from console using get function 6. Write it onto file using put function, 7. Repeat steps 5-6 until end-of-file is encountered. 8. Close the file object fp using close function 9. Open file sample.txt in input mode using open function 10. Initialize vc to Read character-by-character from file using get function 12. If character is a vowel, then increment vc. 13. Repeat steps until end-of-file is encountered 14. Print vc 15. Close the file object fp using close function 16. Stop #include <iostream.h> #include <fstream.h> #include <ctype.h> int main() fstream fp;

23 char ch; fp.open("sample.txt", ios::out); fp.open("sample.txt", ios::in); Ctrl + Z to terminate: how are you i am fine bye ^Z No. of vowels : 10

24 Ex. No: 15 TOWERS OF HANOI To solve Towers of Hanoi problem using stack operations. 2. Get number of disks, say n. 3. Push parameters and return address onto stack 4. If the stopping value has been reached then pop the stack to return to previous level else move all except the final disc from starting to intermediate needle. 5. Move final discs from start to destination needle. 6. Move remaining discs from intermediate to destination needle. 7. Return to previous level by popping stack. 8. Stop Program #include <iostream.h> void tower(int a,char from,char aux,char to) if(a == 1) cout << "Move disc 1 from " << from; cout << " to " << to << "\n"; return; else tower(a-1, from, to, aux); cout << "Move disc " << a << " from " << from; cout << " to " << to <<"\n"; tower(a-1, aux, from, to);

25 int main() int n; cout << "Tower of Hanoi \n"; cout << "Enter number of discs : "; cin >> n; tower(n, 'A','B','C'); return 0; Output Tower of Hanoi Enter number of discs : 2 Move disc 1 from A to B Move disc 2 from A to C Move disc 1 from B to C

26 Ex.No: 16 FINDING THE LARGEST MULTIPLE OF 3 USING QUEUE : To find the Largest Multiples of 3 using Queue : 2. Enter Number of elements 3. Enter the values one by one 4. Sort the values in non-decreasing order. 5. Take Queue 6. Enqueue the elements which on dividing by 3 gives remainder as 0 7. Dequeue the first element from the queue 8. Display the element 9. stop class Queue int a[100],n; void Enqueue() int Dequeu() ; int main() Enter Number of Elements : 6 Enter the values one by one : 12,30,5,2,7,21 The Largest Multiples of 3 is : 30

27 Ex.No: 17 BINARY SEARCH TREE TRAVERSAL To create a binary search tree and to perform different methods of tree traversal. 2. Declare structure node to store element, left child and right child for a binary search tree 3. Declare class bst with member functions insert, preorder, inorder and postorder 4. Define insert member function to add an element a. If first element, then place it as root b. If element < root then traverse left subtree recursively until leaf c. If element > root then traverse right subtree recursively until leaf d. Insert new element as leaf 5. Define preorder member function to perform preorder traversal recursively a. Visit root node b. Visit left subtree c. Visit right subtree 6. Define inorder member function to perform inorder traversal recursively a. Visit left subtree b. Visit root node c. Visit right subtree 7. Define postorder member function to perform postorder traversal recursively a. Visit left subtree b. Visit right subtree c. Visit root node 8. Create object tree for bst class 9. Display a choice menu in main function 10. Accept choice and invoke appropriate member function for tree object 11. Stop #include<iostream.h> #include <process.h> #include<stdlib.h> #include <malloc.h> struct node int element; node *left;

28 node *right; ; typedef struct node *pnode; class bst void insert(int, pnode &); void preorder(pnode); void inorder(pnode); void postorder(pnode); ; int main() int choice, element, left_child, right_child; bst tree; char c = 'y'; pnode root, min, max; root = NULL; while(1) cout << "\n Binary Search Tree \n"; cout << "1.insert 2.preorder 3.inorder 4.postorder"; cout << " 0.Exit \n Enter your choice : "; cin >> choice; switch (choice) case 1: cout << "Enter the new element : "; cin >> element; tree.insert (element, root); cout << "Inorder traversal is : "; tree.inorder(root); break; case 2: break; case 3: break; case 4: break;

29 case 0: exit (0); return 0; Binary Search Tree 1.insert 2.preorder 3.inorder 4.postorder 0.Exit Enter your choice : 1 Enter the new element : 5 Inorder traversal is : 5--> Binary Search Tree 1.insert 2.preorder 3.inorder 4.postorder 0.Exit Enter your choice : 1 Enter the new element : 7 Inorder traversal is : 5-->7--> Binary Search Tree 1.insert 2.preorder 3.inorder 4.postorder 0.Exit Enter your choice : 1 Enter the new element : 3 Inorder traversal is : 3-->5-->7--> Binary Search Tree 1.insert 2.preorder 3.inorder 4.postorder 0.Exit Enter your choice : 2 Preorder traversal is : 5-->3-->7-->

30 Ex.No:18 MINIMUM SPANNING TREES To determine edges for minimum spanning tree in the given graph using Prim's algorithm 2. Define infinity to be a large number, say Declare class prim with requisite data members 4. Define create member function a. Get number of vertices nodes. b. Read adjacency matrix graph using a loop c. For nodes with cost 0, assign infinity using a loop 5. Define findmst member function to determine minimum spanning tree a. Initially all nodes are unselected b. Find smallest edge from the graph connecting the vertex c. Add that vertex d. Print associated cost e. Repeat the process until all vertices are added f. Print total cost of Prim's MST 6. Create object pmst for prim class 7. Stop a. Call create member function b. Call findmst member function #include <iostream.h> #define row 10 #define col 10 #define infi 999 #define false 0 #define true 1 class prims int graph[row][col]; int nodes;

31 prims() void create(); void findmst(); ; int main() prims pmst; cout << "Prims \n"; pmst.create(); cout << "Edges of Minimum Spanning Tree are : \n"; pmst.findmst(); return 0; Prims Enter Total Nodes : 7 Enter Adjacency Matrix : Edges of Minimum Spanning Tree are : 1 -> 4 = 1 1 -> 2 = 2 4 -> 3 = 2 4 -> 7 = 4 7 -> 6 = 1 7 -> 5 = 6 Cost of MST is : 16

32 Ex.No:19 SHORTEST PATH ALGORITHM To find shortest path from a given vertex to all other vertices using Dijkstra algorithm 2. Define infinity to be a large number, say Declare class dijkstra with requisite data members 4. Define read member function to obtain inputs a. Get the number of vertex vertices b. Read adjacency matrix adj using a loop c. Get vertex to start with source. 5. Define initialize member function to do initial configuration a. Initialize distance for each vertex to infinity b. Initialize all nodes marked as false c. Initialize all nodes as without any predecessor 6. Define unmarked member function a. Return vertex with minimum distance amongst unmarked vertices 7. Define calculate member function a. Call initialize member function b. Update variables marked, distance and predecessor for adjacent vertices 8. Define path member function to print path recursively 9. Define output member funct ion a. Call path member function to print path from source to each other vertex b. Print total distance from source to that vertex 10. Create object djk for dijkstra class a. Call read member function b. Call calculate member function c. Call output member function 11. Stop #include<iostream.h> #define infinity 999 class dijkstra int adj[15][15]; int predecessor[15]; int distance[15]; int mark[15]; int source; int vertices;

33 void read(); void initialize(); int unmarked(); void calculate(); void output(); void path(int); ; int main() dijkstra djk; djk.read(); djk.calculate(); cout << "Shortest path from source vertex are : \n"; djk.output(); return 0; Enter number of vertices : 7 Enter adjacency matrix for the graph : (For infinity enter 999) Enter the source vertex : 0 Shortest path from source vertex are : A->A = 0 A->B = 2 A->D->C = 3 A->D = 1 A->D->E = 3 A->D->G->F = 6 A->D->G = 5

Time: 3 HOURS Maximum Marks: 100

Time: 3 HOURS Maximum Marks: 100 ANNA UNIVERSITY:CHENNAI 600 025 M.E/M.Tech. DEGREE EXAMINATIONS, NOV./DEC. 2014 Regulations 2013 Third Semester B.E. Computer Science and Engineering CS6311: PROGRAMMING AND DATA STRUCTURES LABORATORY

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

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

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8) 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

More information

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

Binary Trees. Height 1

Binary Trees. Height 1 Binary Trees Definitions A tree is a finite set of one or more nodes that shows parent-child relationship such that There is a special node called root Remaining nodes are portioned into subsets T1,T2,T3.

More information

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIFTH SEMESTER FINAL EXAMINATION, 2014/2015 SESSION PSD2023 ALGORITHM & DATA STRUCTURE DSEW-E-F-2/13 25 MAY 2015 9.00 AM

More information

SAURASHTRA UNIVERSITY

SAURASHTRA UNIVERSITY SAURASHTRA UNIVERSITY RAJKOT INDIA Accredited Grade A by NAAC (CGPA 3.05) CURRICULAM FOR B.Sc. (Computer Science) Bachelor of Science (Computer Science) (Semester - 1 Semester - 2) Effective From June

More information

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples: Unit IV Pointers and Polymorphism in C++ Concepts of Pointer: A pointer is a variable that holds a memory address of another variable where a value lives. A pointer is declared using the * operator before

More information

CS201 Latest Solved MCQs

CS201 Latest Solved MCQs Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability

More information

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

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK Degree & Branch : B.E E.C.E. Year & Semester : II / IV Section : ECE 1, 2 &

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED

More information

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

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

Question Paper Code : 97044

Question Paper Code : 97044 Reg. No. : Question Paper Code : 97044 B.E./B.Tech. DEGREE EXAMINATION NOVEMBER/DECEMBER 2014 Third Semester Computer Science and Engineering CS 6301 PROGRAMMING AND DATA STRUCTURES-II (Regulation 2013)

More information

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

Quiz Start Time: 09:34 PM Time Left 82 sec(s) Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability

More information

Chapter 15 - C++ As A "Better C"

Chapter 15 - C++ As A Better C Chapter 15 - C++ As A "Better C" Outline 15.1 Introduction 15.2 C++ 15.3 A Simple Program: Adding Two Integers 15.4 C++ Standard Library 15.5 Header Files 15.6 Inline Functions 15.7 References and Reference

More information

CS 216 Exam 1 Fall SOLUTION

CS 216 Exam 1 Fall SOLUTION CS 216 Exam 1 Fall 2004 - SOLUTION Name: Lab Section: Email Address: Student ID # This exam is closed note, closed book. You will have an hour and fifty minutes total to complete the exam. You may NOT

More information

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

Cpt S 122 Data Structures. Course Review FINAL. Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 Data Structures Course Review FINAL Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Final When: Wednesday (12/12) 1:00 pm -3:00 pm Where: In Class

More information

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions. Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008 Certified CRISL rated 'A'

More information

Chapter 20: Binary Trees

Chapter 20: Binary Trees Chapter 20: Binary Trees 20.1 Definition and Application of Binary Trees Definition and Application of Binary Trees Binary tree: a nonlinear linked list in which each node may point to 0, 1, or two other

More information

Introduction to C++ Systems Programming

Introduction to C++ Systems Programming Introduction to C++ Systems Programming Introduction to C++ Syntax differences between C and C++ A Simple C++ Example C++ Input/Output C++ Libraries C++ Header Files Another Simple C++ Example Inline Functions

More information

AN OVERVIEW OF C++ 1

AN OVERVIEW OF C++ 1 AN OVERVIEW OF C++ 1 OBJECTIVES Introduction What is object-oriented programming? Two versions of C++ C++ console I/O C++ comments Classes: A first look Some differences between C and C++ Introducing function

More information

Final Exam Solutions PIC 10B, Spring 2016

Final Exam Solutions PIC 10B, Spring 2016 Final Exam Solutions PIC 10B, Spring 2016 Problem 1. (10 pts) Consider the Fraction class, whose partial declaration was given by 1 class Fraction { 2 public : 3 Fraction ( int num, int den ); 4... 5 int

More information

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University) Estd: 1994 JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli - 621014 (An approved by AICTE and Affiliated to Anna University) ISO 9001:2000 Certified Subject Code & Name : CS 1202

More information

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

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \ BSc IT C Programming (2013-2017) Unit I Q1. What do you understand by type conversion? (2013) Q2. Why we need different data types? (2013) Q3 What is the output of the following (2013) main() Printf( %d,

More information

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT Two Mark Questions UNIT - I 1. DEFINE ENCAPSULATION. Encapsulation is the process of combining data and functions

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : M.Sc CST Semester / Year : EVEN / II Subject Name

More information

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

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC) SET - 1 II B. Tech I Semester Supplementary Examinations, May/June - 2016 PART A 1. a) Write a procedure for the Tower of Hanoi problem? b) What you mean by enqueue and dequeue operations in a queue? c)

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

MIDTERM EXAMINATION Spring 2010 CS301- Data Structures

MIDTERM EXAMINATION Spring 2010 CS301- Data Structures MIDTERM EXAMINATION Spring 2010 CS301- Data Structures Question No: 1 Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the

More information

Final Exam. Name: Student ID: Section: Signature:

Final Exam. Name: Student ID: Section: Signature: Final Exam PIC 10B, Spring 2016 Name: Student ID: Section: Discussion 3A (2:00 2:50 with Kelly) Discussion 3B (3:00 3:50 with Andre) I attest that the work presented in this exam is my own. I have not

More information

Topic Binary Trees (Non-Linear Data Structures)

Topic Binary Trees (Non-Linear Data Structures) Topic Binary Trees (Non-Linear Data Structures) CIS210 1 Linear Data Structures Arrays Linked lists Skip lists Self-organizing lists CIS210 2 Non-Linear Data Structures Hierarchical representation? Trees

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

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

End-Term Examination Second Semester [MCA] MAY-JUNE 2006 (Please write your Roll No. immediately) Roll No. Paper Code: MCA-102 End-Term Examination Second Semester [MCA] MAY-JUNE 2006 Subject: Data Structure Time: 3 Hours Maximum Marks: 60 Note: Question 1.

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

Binary Trees and Binary Search Trees

Binary Trees and Binary Search Trees Binary Trees and Binary Search Trees Learning Goals After this unit, you should be able to... Determine if a given tree is an instance of a particular type (e.g. binary, and later heap, etc.) Describe

More information

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object CHAPTER 1 Introduction to Computers and Programming 1 1.1 Why Program? 1 1.2 Computer Systems: Hardware and Software 2 1.3 Programs and Programming Languages 8 1.4 What is a Program Made of? 14 1.5 Input,

More information

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE1303. B.Tech. Year - II

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE1303. B.Tech. Year - II Subject Code: 01CE1303 Subject Name: Object Oriented Design and Programming B.Tech. Year - II Objective: The objectives of the course are to have students identify and practice the object-oriented programming

More information

Largest Online Community of VU Students

Largest Online Community of VU Students WWW.VUPages.com http://forum.vupages.com WWW.VUTUBE.EDU.PK Largest Online Community of VU Students MIDTERM EXAMINATION SEMESTER FALL 2003 CS301-DATA STRUCTURE Total Marks:86 Duration: 60min Instructions

More information

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text)

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text) Lec 17 April 8 Topics: binary Trees expression trees Binary Search Trees (Chapter 5 of text) Trees Linear access time of linked lists is prohibitive Heap can t support search in O(log N) time. (takes O(N)

More information

12 Abstract Data Types

12 Abstract Data Types 12 Abstract Data Types 12.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT). Define

More information

For Teacher's Use Only Q No Total Q No Q No

For Teacher's Use Only Q No Total Q No Q No Student Info Student ID: Center: Exam Date: FINALTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Time: 90 min Marks: 58 For Teacher's Use Only Q No. 1 2 3 4 5 6 7 8 Total Marks Q No. 9

More information

Example Final Questions Instructions

Example Final Questions Instructions Example Final Questions Instructions This exam paper contains a set of sample final exam questions. It is for practice purposes only. You ll most likely need longer than three hours to answer all the questions.

More information

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the elements may locate at far positions

More information

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

ROOT: A node which doesn't have a parent. In the above tree. The Root is A.

ROOT: A node which doesn't have a parent. In the above tree. The Root is A. TREE: A tree is a finite set of one or more nodes such that there is a specially designated node called the Root, and zero or more non empty sub trees T 1, T 2...T k, each of whose roots are connected

More information

CSE030 Fall 2012 Final Exam Friday, December 14, PM

CSE030 Fall 2012 Final Exam Friday, December 14, PM CSE030 Fall 2012 Final Exam Friday, December 14, 2012 3-6PM Write your name here and at the top of each page! Name: Select your lab session: Tuesdays Thursdays Paper. If you have any questions or need

More information

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate

More information

Name CPTR246 Spring '17 (100 total points) Exam 3

Name CPTR246 Spring '17 (100 total points) Exam 3 Name CPTR246 Spring '17 (100 total points) Exam 3 1. Linked Lists Consider the following linked list of integers (sorted from lowest to highest) and the changes described. Make the necessary changes in

More information

PRACTICAL LIST FOR EVEN SEMESTERS (PGDCA/MCA/MSC (CS))

PRACTICAL LIST FOR EVEN SEMESTERS (PGDCA/MCA/MSC (CS)) PRACTICAL LIST FOR EVEN SEMESTERS (PGDCA/MCA/MSC (CS)) SEMSTER 2 nd Programme: PGDCA/MCA/MSC (CS) Course: Practical (Based on MS-06) Code: MS-10 Max Marks: 100 Data Structure and Algorithms (Based on MS-06)

More information

Graphs & Digraphs Tuesday, November 06, 2007

Graphs & Digraphs Tuesday, November 06, 2007 Graphs & Digraphs Tuesday, November 06, 2007 10:34 PM 16.1 Directed Graphs (digraphs) like a tree but w/ no root node & no guarantee of paths between nodes consists of: nodes/vertices - a set of elements

More information

Computer Science E-22 Practice Final Exam

Computer Science E-22 Practice Final Exam name Computer Science E-22 This exam consists of three parts. Part I has 10 multiple-choice questions that you must complete. Part II consists of 4 multi-part problems, of which you must complete 3, and

More information

Programming. C++ Basics

Programming. C++ Basics Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++

More information

First Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

First Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms... First Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms.... Q1) What are some of the applications for the tree data structure? Q2) There are 8, 15, 13, and

More information

Data Structure Advanced

Data Structure Advanced Data Structure Advanced 1. Is it possible to find a loop in a Linked list? a. Possilbe at O(n) b. Not possible c. Possible at O(n^2) only d. Depends on the position of loop Solution: a. Possible at O(n)

More information

POINTERS - Pointer is a variable that holds a memory address of another variable of same type. - It supports dynamic allocation routines. - It can improve the efficiency of certain routines. C++ Memory

More information

Data Structures And Algorithms

Data Structures And Algorithms Data Structures And Algorithms Binary Trees Eng. Anis Nazer First Semester 2017-2018 Definitions Linked lists, arrays, queues, stacks are linear structures not suitable to represent hierarchical data,

More information

Unit-V File operations

Unit-V File operations Unit-V File operations What is stream? C++ IO are based on streams, which are sequence of bytes flowing in and out of the programs. A C++ stream is a flow of data into or out of a program, such as the

More information

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C Practical -1 Babaria Institute of Technology LEARN CONCEPTS OF OOP 1. Explain Object Oriented Paradigm with figure. 2. Explain basic Concepts of OOP with example a. Class b. Object c. Data Encapsulation

More information

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

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May www.jwjobs.net R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 *******-****** 1. a) Which of the given options provides the

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Get Unique study materials from

Get Unique study materials from Downloaded from www.rejinpaul.com VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : IV Section : EEE - 1 & 2 Subject Code

More information

CHOICE BASED CREDIT SYSTEM (With effect from )

CHOICE BASED CREDIT SYSTEM (With effect from ) B.Sc. Computer Science Syllabus Under the CHOICE BASED CREDIT SYSTEM (With effect from 2017-18) DEPARTMENT OF COMPUTER SCIENCE University College,TU,Nizamabad-503322 Syllabus for Computer Science (With

More information

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

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1 QUESTION BANK ON COURSE: 304: PRELIMINARIES: 1. What is array of pointer, explain with appropriate example? 2 2. Differentiate between call by value and call by reference, give example. 3. Explain pointer

More information

S.E. Sem. III [INFT] Data Structures & Analysis. Primitive Linear Non Linear

S.E. Sem. III [INFT] Data Structures & Analysis. Primitive Linear Non Linear S.E. Sem. III [INFT] Data Structures & Analysis Time : 3 Hrs.] Prelim Paper Solution [Marks : 80 Q.1(a) Explain different types of data structures with examples. [5] Ans.: Types of Data Structure : Data

More information

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p. Preface to the Second Edition p. iii Preface to the First Edition p. vi Brief Contents p. ix Introduction to C++ p. 1 A Review of Structures p. 1 The Need for Structures p. 1 Creating a New Data Type Using

More information

Data Structure & Algorithms Laboratory Manual (CS 392)

Data Structure & Algorithms Laboratory Manual (CS 392) Institute of Engineering & Management Department of Computer Science & Engineering Data Structure Laboratory for 2 nd year 3 rd semester Code: CS 392 Data Structure & Algorithms Laboratory Manual (CS 392)

More information

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty! Chapter 6 - Functions return type void or a valid data type ( int, double, char, etc) name parameter list void or a list of parameters separated by commas body return keyword required if function returns

More information

Revision Statement while return growth rate asymptotic notation complexity Compare algorithms Linear search Binary search Preconditions: sorted,

Revision Statement while return growth rate asymptotic notation complexity Compare algorithms Linear search Binary search Preconditions: sorted, [1] Big-O Analysis AVERAGE(n) 1. sum 0 2. i 0. while i < n 4. number input_number(). sum sum + number 6. i i + 1 7. mean sum / n 8. return mean Revision Statement no. of times executed 1 1 2 1 n+1 4 n

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak OBJECT ORIENTED PROGRAMMING Ms. Ajeta Nandal C.R.Polytechnic,Rohtak OBJECT ORIENTED PARADIGM Object 2 Object 1 Data Data Function Function Object 3 Data Function 2 WHAT IS A MODEL? A model is an abstraction

More information

Binary Trees, Binary Search Trees

Binary Trees, Binary Search Trees Binary Trees, Binary Search Trees Trees Linear access time of linked lists is prohibitive Does there exist any simple data structure for which the running time of most operations (search, insert, delete)

More information

Course Review for Finals. Cpt S 223 Fall 2008

Course Review for Finals. Cpt S 223 Fall 2008 Course Review for Finals Cpt S 223 Fall 2008 1 Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e.,

More information

OOP THROUGH C++(R16) int *x; float *f; char *c;

OOP THROUGH C++(R16) int *x; float *f; char *c; What is pointer and how to declare it? Write the features of pointers? A pointer is a memory variable that stores the address of another variable. Pointer can have any name that is legal for other variables,

More information

Lecture Notes. char myarray [ ] = {0, 0, 0, 0, 0 } ; The memory diagram associated with the array can be drawn like this

Lecture Notes. char myarray [ ] = {0, 0, 0, 0, 0 } ; The memory diagram associated with the array can be drawn like this Lecture Notes Array Review An array in C++ is a contiguous block of memory. Since a char is 1 byte, then an array of 5 chars is 5 bytes. For example, if you execute the following C++ code you will allocate

More information

Binary Trees. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I

Binary Trees. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I Binary Trees College of Computing & Information Technology King Abdulaziz University CPCS-204 Data Structures I Outline Tree Stuff Trees Binary Trees Implementation of a Binary Tree Tree Traversals Depth

More information

FORM 2 (Please put your name and form # on the scantron!!!!)

FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam 2: FORM 2 (Please put your name and form # on the scantron!!!!) True (A)/False(B) (2 pts each): 1. Recursive algorithms tend to be less efficient than iterative algorithms. 2. A recursive function

More information

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should Use better data structures

More information

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

DEPARTMENT OF COMPUTER APPLICATIONS B.C.A. - FIRST YEAR ( REGULATION) SECOND SEMESTER LESSON PLAN SRM INSTITUTE OF SCIENCE AND TECHNOLOGY DEPARTMENT OF COMPUTER APPLICATIONS B.C.A. - FIRST YEAR (2015-2016 REGULATION) SECOND SEMESTER LESSON PLAN SRM INSTITUTE OF SCIENCE AND TECHNOLOGY FACULTY OF SCIENCE AND HUMANITIES SRM NAGAR, KATTANKULATHUR

More information

Come and join us at WebLyceum

Come and join us at WebLyceum Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad

More information

Object Oriented Programming. Solved MCQs - Part 2

Object Oriented Programming. Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 It is possible to declare as a friend A member function A global function A class All of the above What

More information

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS 1. Define global declaration? The variables that are used in more

More information

This examination has 11 pages. Check that you have a complete paper.

This examination has 11 pages. Check that you have a complete paper. MARKING KEY The University of British Columbia MARKING KEY Computer Science 252 2nd Midterm Exam 6:30 PM, Monday, November 8, 2004 Instructors: K. Booth & N. Hutchinson Time: 90 minutes Total marks: 90

More information

Higher National Diploma in Information Technology. First Year Second Semester Examination IT 2003-Data Structure and Algorithm.

Higher National Diploma in Information Technology. First Year Second Semester Examination IT 2003-Data Structure and Algorithm. Higher National Diploma in Information Technology First Year Second Semester Examination-2013 IT 2003-Data Structure and Algorithm Answer Guide (01) I)What is Data structure A data structure is an arrangement

More information

END TERM EXAMINATION

END TERM EXAMINATION END TERM EXAMINATION THIRD SEMESTER [BCA] DECEMBER 2007 Paper Code: BCA 209 Subject: Object Oriented Programming Time: 3 hours Maximum Marks: 75 Note: Attempt all questions. Internal choice is indicated.

More information

Problem Solving with C++

Problem Solving with C++ GLOBAL EDITION Problem Solving with C++ NINTH EDITION Walter Savitch Kendrick Mock Ninth Edition PROBLEM SOLVING with C++ Problem Solving with C++, Global Edition Cover Title Copyright Contents Chapter

More information

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures

More information

SELF-BALANCING SEARCH TREES. Chapter 11

SELF-BALANCING SEARCH TREES. Chapter 11 SELF-BALANCING SEARCH TREES Chapter 11 Tree Balance and Rotation Section 11.1 Algorithm for Rotation BTNode root = left right = data = 10 BTNode = left right = data = 20 BTNode NULL = left right = NULL

More information

Code No: R Set No. 1

Code No: R Set No. 1 Code No: R05010106 Set No. 1 1. (a) Draw a Flowchart for the following The average score for 3 tests has to be greater than 80 for a candidate to qualify for the interview. Representing the conditional

More information

CS 115 Exam 3, Spring 2010

CS 115 Exam 3, Spring 2010 Your name: Rules You must briefly explain your answers to receive partial credit. When a snippet of code is given to you, you can assume o that the code is enclosed within some function, even if no function

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

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

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer) COSC 2007 Data Structures II Final Exam Thursday, April 13 th, 2006 This is a closed book and closed notes exam. There are total 3 parts. Please answer the questions in the provided space and use back

More information

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS Syllabus: Pointers and Preprocessors: Pointers and address, pointers and functions (call by reference) arguments, pointers and arrays, address arithmetic, character pointer and functions, pointers to pointer,initialization

More information

Multiple choice questions. Answer on Scantron Form. 4 points each (100 points) Which is NOT a reasonable conclusion to this sentence:

Multiple choice questions. Answer on Scantron Form. 4 points each (100 points) Which is NOT a reasonable conclusion to this sentence: Multiple choice questions Answer on Scantron Form 4 points each (100 points) 1. Which is NOT a reasonable conclusion to this sentence: Multiple constructors for a class... A. are distinguished by the number

More information

* Due 11:59pm on Sunday 10/4 for Monday lab and Tuesday 10/6 Wednesday Lab

* Due 11:59pm on Sunday 10/4 for Monday lab and Tuesday 10/6 Wednesday Lab ===Lab Info=== *100 points * Due 11:59pm on Sunday 10/4 for Monday lab and Tuesday 10/6 Wednesday Lab ==Assignment== In this assignment you will work on designing a class for a binary search tree. You

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

Object Oriented Programming using C++

Object Oriented Programming using C++ Object Oriented Programming using C++ Overview Problem Solving Features of an OOL Basic Syntax Programming Paradigms Solving a Programming Problem Analysis Design Coding Management Programming paradigms

More information

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

LESSON PLAN B.C.A. - FIRST YEAR ( REGULATION) SECOND SEMESTER DEPARTMENT OF COMPUTER APPLICATIONS LESSON PLAN B.C.A. - FIRST YEAR (2014-2015 REGULATION) SECOND SEMESTER SRM UNIVERSITY FACULTY OF SCIENCE AND HUMANITIES SRM NAGAR, KATTANKULATHUR 603 203 SRM UNIVERSITY

More information

Binary Trees. Examples:

Binary Trees. Examples: Binary Trees A tree is a data structure that is made of nodes and pointers, much like a linked list. The difference between them lies in how they are organized: In a linked list each node is connected

More information