Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tafila Technical University Faculty of Engineering Department of Communication and Computer Engineering Data Structures & Algorithms Fall Semester 2021 Final Exam Time: 100 minutes Name

image text in transcribed

Tafila Technical University Faculty of Engineering Department of Communication and Computer Engineering Data Structures & Algorithms Fall Semester 2021 Final Exam Time: 100 minutes Name (in Arabic): Instructor: 4 (1) The stack content after the following series of stack operations: S.push(1);S.push(2);S.pop();S.push(3);S.top();S.push(4); A. [1,4] B. (1,2,3,4] C. (1,3,4 D. [1,2,4] (2) After the operations of the question (1), the output of S.top is: A. [1,2,3] B.4 C. [4] D. 1 (3) After the operations of the question (1), the output of len(S) is: A. 1 B. 2 C. 3 D. 4 (4) The In the array-based stack, the fit method to be used yielding the top() method function is: [2 pt] A. list[-1] B. list[@] C. list.append() D. list.pop() (5) The value of the var2 variable after the execution is: [2 pt] 1 X=ArrayStack() 2 stri = "Hello"; var2 = ".. for i in str1: X.push(i) for i in stri: var2 += X.pop() A. l'H', 'e','1','1','') B. ['H', 'e',T,T,'' C. Hello D. olleH Solve the questions (6,7,8) based on the following Python script: Y = ArrayQueue() 2 vari = "Hi Everybody"; var2 = "" 3 for i in vari: Y. enqueue(i) 4 print(Y.is_empty()) for i in vari: var2 += str(Y.dequeue()) 6 print(Y.is_empty()) (6) The output of the print statement line 4 is: [2 pt] A. No B. Yes C. True D. False (7) The value of the sequence var2[0:2] after execution the script is: [2 pt] B. "dy" A. "H" D. "yd" C. "Hi" (2 pt] (8) After execution the first 3 lines the value of len(V) is: B. 12 A. 11 D. 2 C. 5 6 1 5 Page 1 of 4 GOOD LUCK

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

Students also viewed these Databases questions

Question

5.2 Summarize the environment of recruitment.

Answered: 1 week ago