University of Palestine. Final Exam 2 nd semester 2014/2015 Total Grade: 50

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

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

17CS33:Data Structures Using C QUESTION BANK

1. Stack overflow & underflow 2. Implementation: partially filled array & linked list 3. Applications: reverse string, backtracking

CIS Fall Data Structures Midterm exam 10/16/2012

Tree. Virendra Singh Indian Institute of Science Bangalore Lecture 11. Courtesy: Prof. Sartaj Sahni. Sep 3,2010

CE 221 Data Structures and Algorithms

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

PA3 Design Specification

Formal Languages and Automata Theory, SS Project (due Week 14)

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

Largest Online Community of VU Students

Largest Online Community of VU Students

Data Structures Question Bank Multiple Choice

Chapter 4 Trees. Theorem A graph G has a spanning tree if and only if G is connected.

Largest Online Community of VU Students

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?

Final Exam Data Structure course. No. of Branches (5)

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

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

PESIT Bangalore South Campus Department of MCA Course Information for

Computer Science E-22 Practice Final Exam

Section 5.5. Left subtree The left subtree of a vertex V on a binary tree is the graph formed by the left child L of V, the descendents

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

CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false.

namibia UniVERSITY OF SCIEnCE AnD TECHnOLOGY

Advanced Java Concepts Unit 5: Trees. Notes and Exercises

CS301- Data Structures LATEST SOLVED MCQS & SUBJECTIVE FROM MIDTERM PAPERS. 18 December 2014

Stacks, Queues and Hierarchical Collections

Tree. A path is a connected sequence of edges. A tree topology is acyclic there is no loop.

Why Do We Need Trees?

MIDTERM EXAMINATION Spring 2010 CS301- Data Structures

CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

Dynamic Data Structures

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

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

Sample Question Paper

Code No: R Set No. 1

DYNAMIC MEMORY ALLOCATION AND DEALLOCATION

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

Stacks, Queues and Hierarchical Collections. 2501ICT Logan

Introduction. for large input, even access time may be prohibitive we need data structures that exhibit times closer to O(log N) binary search tree

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- OCTOBER, 2012 DATA STRUCTURE

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

Binary Trees, Binary Search Trees

Fundamentals of Data Structure

F453 Module 7: Programming Techniques. 7.2: Methods for defining syntax

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

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

Summer Final Exam Review Session August 5, 2009

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

CP2 Revision. theme: dynamic datatypes & data structures

Computer Science 210 Data Structures Siena College Fall Topic Notes: Trees

12 Abstract Data Types

Recursive Data Structures and Grammars

Department of Computer Science and Technology

Data Structure Advanced

March 20/2003 Jayakanth Srinivasan,

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

9/29/2016. Chapter 4 Trees. Introduction. Terminology. Terminology. Terminology. Terminology

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

Course Review for. Cpt S 223 Fall Cpt S 223. School of EECS, WSU

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

1 P age DS & OOPS / UNIT II

COMP 250 Fall binary trees Oct. 27, 2017

Data Structure. IBPS SO (IT- Officer) Exam 2017

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

Garbage Collection: recycling unused memory

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

Objective Questions for Online Practical Exams under CBCS Scheme Subject: Data Structure-I (CS-113)

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

Trees. CSE 373 Data Structures

CS8391-DATA STRUCTURES

INSTITUTE OF AERONAUTICAL ENGINEERING

Elementary Data Structures. Stacks, Queues, & Lists Amortized analysis Trees

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

Trees. (Trees) Data Structures and Programming Spring / 28

This is a set of practice questions for the final for CS16. The actual exam will consist of problems that are quite similar to those you have

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

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

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

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο

IT 4043 Data Structures and Algorithms. Budditha Hettige Department of Computer Science

Binary Trees

CSE 373 Spring Midterm. Friday April 21st

TREES. Trees - Introduction

CS301 - Data Structures Glossary By

Information Science 2

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

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

CSCI2100B Data Structures Trees

a) State the need of data structure. Write the operations performed using data structures.

CSE Data Structures and Introduction to Algorithms... In Java! Instructor: Fei Wang. Mid-Term Exam. CSE2100 DS & Algorithms 1

Lecture 26. Introduction to Trees. Trees

Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

CSI33 Data Structures

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

Data Structures. Outline. Introduction Linked Lists Stacks Queues Trees Deitel & Associates, Inc. All rights reserved.

CMSC351 - Fall 2014, Homework #2

Transcription:

First Question Q1 B1 Choose the best Answer: No. of Branches (1) (10/50) 1) 2) 3) 4) Suppose we start with an empty stack and then perform the following operations: Push (A); Push (B); Pop; Push (C); Top; Pop; what will be the contents of the stack after these operations? a) B,A,C b) B,C,A c) A d) A,B,C e) None of the above You have implemented the queue with a linked list, keeping track of a front node and a rear node with two reference variables. Which of these reference variables will change during an insertion into an EMPTY queue? a) Neither changes b) Only front changes c) Only rear changes. d) Both change. Suppose that we are working with linked lists that are circular, singly-linked, and have no head node. Suppose that the link field is named next. Assume L is the first node in a nonempty list, and let x be any node in this list. Which of the statements below is true if and only if x is the last node in the list? a) x = null b) x.next = null c) x.next = L d) x.next = L.next Suppose that a certain binary tree on seven nodes has in-order traversal PQRSTUV and postorder traversal QRPTUVS. What is the last character in its preorder traversal? a) R b) S c) T d) U e) V 1/8

5) Consider the following pseudocode: declare a stack of characters while ( there are more characters in the word to read ) { read a character push the character on the stack } while ( the stack is not empty ) { pop a character off the stack write the character to the screen } What is written to the screen for the input "carpets"? a) Serc b) carpets c) Steprac d) ccaarrppeettss. 6) What letter is in the fourth node in an inorder traversal of the tree below? A b) B. c) C. d) D. e) E. 7) Which of the choices below is Not a complete binary tree? Circle the choice. 8) Suppose you push 10, 20, 30, and 40 onto the stack. Then you pop three Items. Which one is left on the stack? a) 40 b) 10 c) 20 d)30 2/8

9) When the array stack is empty the top t is equal to : a) 0 b) 1 c) -1 d) NULL 10) Suppose you insert 15, 25, 35, and 45 into a queue. Then you remove three items. Which one is left? a) 45 b) 35 c) 15 d) 25 Second Question No. of Branches (3) Q2 B1 Given the following Binary Tree, Solve the following Questions? (20/50) (7/20) Q2 B2 a) What are the ancestors of node E? --------------------- b) What are the descendants of node B? --------------------- c) What is the height of the tree? --------------------------- d) What is the maximum possible number of nodes at the level of node G? ------------- e) What is the result of visiting this tree using inorder traversal? ----------------------------------------------------------------------------------- f) What is the result of visiting this tree using preorder traversal? ----------------------------------------------------------------------------------- g) What is the result of visiting this tree using postorder traversal? -----------------------------------------------------------------------------------. 3/8 (5/20)

Consider the following fully parenthesized arithmetic expression: (1 - (((3+4) * (5-6)) / (7*9))) Draw an expression tree for this expression Q2 B3 (8/20) Write the Algorithm of the Inorder Traversal of a Binary Tree? 4/8

Third Question No. of Branches (3) (20/50) Q3 B1) Write a program that reads in a sequence of characters and prints them in reverse order. Use a stack. (5/20 )............ 5/8

Q3 B2 ) (5/20 ) Suppose we are dealing with linked lists that are doubly-linked, have no list header, and are not circular; let L be the first node in the list. The Node class has three fields: data, next, and prev, with the usual meanings. Below is an example of this representation for the list A,B,C,D,E. Write a JAVA Method deletesecond(l) that deletes the second node in the list that L represents. 6/8

Q3 B3 ) (5/20) A palindrome is a word that reads the same forward as it does backward. For example, the following words are palindrome, because we can read these words backward the same way as if we read them forward:radar, hannah, refer, stats, level Write a method called CheckPal that takes the word as an array of characters, this method uses stack to checks if the given word is palindrome or not. 7/8

Q3 B4 ) (5/20) Write a complete java program that has a class called recursion which includes a recursive method called sum_range which takes two integers n, m and then returns the sum of integers from n to m. Call the method in the main and then print the result End of Questions Good Luck 8/8