SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
Page | 1
PART 1 – Multiple Choice Questions
1. Which of the following is FALSE about linked lists
A. The data structure includes the link to another object of the same type
B. The data set are stored in contiguous order in memory
C. The size is dynamic during run-time
D. Memory is allocated at run-time
2. The advantage of arrays over linked lists is
A. Direct access
B. Less memory usage
C. Easier to implement
D. Dynamic memory allocation
3. Which of the following structures is suitable to keep track of a sequence printing jobs
sent to a network printer?
A. Trees
B. Stack
C. Queues
D. Lists
4. The following problems best solved using stack structures, EXCEPT
A. Balancing of parenthesis
B. Evaluation of postfix expressions
C. Removal of items in random order
D. Evaluation of functions containing recursive calls
5. Given the following sequence of operations performed on a stack:
push (5.0), push (9.5), pop, push (27.5), push (12.7), push (0), pop, pop, push
(31.2)
What will be the sequence of items in the stack as a result?
A. 31.2 0.0 12.7 27.5 9.5 5.0
B. 27.5 9.5 5.0
C. 3.12 27.5 5.0
D. Stack is empty
Page | 2
6. Suppose myList is an object of List data structure, and myList.displayList() produces the
following output:
28 7 76 48 70
What would be the output when the following statements are executed?
myList.InsertNode(2, 10);
myList.DisplayList();
A. 10 28 7 76 48 70
B. 28 7 76 10 48 70
C. 28 7 76 48 70 10
D. 28 7 10 76 48 70
7. Suppose an array myArr contains the following sequences of integers:
28 7 76 48 70
What would be resulting sequence of MyArr when the following statement is executed?
myArr [2] = 10;
A. 10 28 7 76 48
B. 28 7 76 10 48
C. 28 7 10 48 70
D. 7 10 76 48 70
8. Which of the following is FALSE when using recursion
A. The recursions must be assumed to work all the time
B. You must have a base case which can be solved without recursion
C. The recursive call must always make progress towards the base case
D. The recursive calls must always be compounded in multiple recursive calls
9. How many times will the symbol ‘#’ be printed by the call foo (4)?
void foo (int i) {
if (i > 1) {
foo (i/2);
foo (i/2);
}
cout << "#";
}
A. 6
B. 7
C. 8
D. 9
Page | 3
10. Which of the following statements about QUEUES is FALSE ?
A. New items can only be inserted at the end position
B. The items are processed in a queue on a First in First out basis
C. The main operations of a queue is enqueueing and dequeueing
D. Items cannot be removed from a queue at the beginning of queue
11. In linked lists, there are no NULL links in
A. linear doubly linked list
B. circular linked list
C. single linked list
D. All of the above
12. The range of 4-bits unsigned integer is between:
A. 0 to 15
B. 1 to 16
C. -7 to 8
D. -15 to 14
13. When a new node is inserted in between a linked list, which of these is TRUE:
A. nodes appearing after the new node needs to be moved
B. nodes appearing before the new node needs to be moved
C. nodes appearing before and after the new node need to be moved
D. None of the above
14. One DIFFERENCE between a queue and a stack is:
A. Queues require linked lists, but stacks require array
B. Stacks require linked lists, but queues require array
C. Queues use two ends of the structure; stacks use only one.
D. Stacks use two ends of the structure; queues use only one.
15. The address of an element [i, j] in a m × n matrix based on the column-wise order can be ______
A. m * ( i – 2 ) + j
B. m * ( j – 2 ) + i
C. n* ( i – 1 ) + j
D. n* ( i – 1) + (j – 1)
Page | 4
PART 2 – Short Answer Questions
1. Given the following code:
#include <iostream>
using namespace std;
int myfunction(int);
int main () {
int input, answer;
cout <<"Enter an integer: ";
cin >> input;
answer = myfunction(input);
cout << endl<<"The answer "<<input<< "! is " << answer;
return 0;
}
int myfunction (int num) {
cout <<"Fib " << num<< " is " ;
if (num == 0)
return 0;
else (num == 1)
return 1;
else
return myfunction (num-1) + myfunction (num-2);
}
Write the output of the program if the user types 4 as input?
2. Discuss the pros and cons of choosing linked list implementation for lists, stacks
and queues.
3. Suppose a queue called myQueue is implemented using a circular array of
MAXSIZE = 7. Illustrate to show the step-by-step effects in myQueue if the following
sequence of statements is executed:
myQueue.enqueue (‘F’)
myQueue.enqueue (‘C’)
myQueue.enqueue (‘Q’)
myQueue.dequeue
myQueue.enqueue (‘X’)
myQueue.enqueue (‘Z’)
myQueue.dequeue
myQueue.enqueue (‘L’)
myQueue.enqueue (‘S’)
myQueue.enqueue (‘W’)
myQueue.enqueue (‘C’)
myQueue.dequeue
Page | 5
4. In C++, a variable that stores integer values can be declared as short (2 bytes or
16 bits) or int (bytes or 32 bits). Furthermore, floating-point numbers can be
declared as float (4 bytes or 32 bits) or double (8 bytes or 64 bits) based on the
IEEE Standard for Floating Point Arithmetic (IEEE-754).
Determine the corresponding binary values that are stored in the computer for the
following variable declarations:
a. unsigned short a = 15;
b. short b = -15;
c. float c = -52.25
5. Use stacks to show the step-by-step evaluation of the post-fix expression given
below:
5.2 2.0 1.5 * + 4.0 2.0 2.0 ^ * -
6. Given below is a recursive method of function f for the value x. Write an equivalent
program segment using iterative method.
int f (int x){
if (x == 0)
return 0;
else
return 2 * f (x – 1) + x * x;
}
7. The elements in an array may be stored based on a row-wise or column-wise
arrangement depending on the programming language used.
Suppose the dimensions of an array myGoodArray are 7X9X8.
Given the address of myGoodArray [4, z, 3] based on the column-wise method is
438, when the base address (B) is 10, with size of each element (W) is 2, and lowest
index of each dimension is 0,
a. Find z.
b. Determine the address of the same element if it is implemented in row-wise
method.
8. Write an algorithm which checks if the brackets in an expression are balanced and
reports an error if the matching brackets is missing.

Weitere ähnliche Inhalte

Was ist angesagt?

Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)MountAbuRohini
 
Cplus plus abd datastructure
Cplus plus abd datastructureCplus plus abd datastructure
Cplus plus abd datastructureprabhatjon
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksMohammad Vaseem Akaram
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomeshpraveensomesh
 
Ec2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.orgEc2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.organnaunivedu
 
Aloha paper for cdac ccpp
Aloha paper  for  cdac ccppAloha paper  for  cdac ccpp
Aloha paper for cdac ccppprabhatjon
 
CDAC CCAT examination important question
CDAC CCAT examination important questionCDAC CCAT examination important question
CDAC CCAT examination important questionprabhatjon
 
Assignment week0 c++
Assignment  week0 c++Assignment  week0 c++
Assignment week0 c++Netaji Gandi
 
Computer science ms
Computer science msComputer science ms
Computer science msB Bhuvanesh
 
Comp 328 final guide
Comp 328 final guideComp 328 final guide
Comp 328 final guidekrtioplal
 
C and data structure
C and data structureC and data structure
C and data structureprabhatjon
 
FP305 data structure PAPER FINAL SEM 3
FP305 data structure PAPER FINAL SEM 3FP305 data structure PAPER FINAL SEM 3
FP305 data structure PAPER FINAL SEM 3Syahriha Ruslan
 
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPERCLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPERRc Os
 

Was ist angesagt? (19)

Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)
 
Cplus plus abd datastructure
Cplus plus abd datastructureCplus plus abd datastructure
Cplus plus abd datastructure
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
 
Assignment
AssignmentAssignment
Assignment
 
Core java
Core javaCore java
Core java
 
Ec2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.orgEc2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.org
 
Aloha paper for cdac ccpp
Aloha paper  for  cdac ccppAloha paper  for  cdac ccpp
Aloha paper for cdac ccpp
 
CDAC CCAT examination important question
CDAC CCAT examination important questionCDAC CCAT examination important question
CDAC CCAT examination important question
 
Assignment week0 c++
Assignment  week0 c++Assignment  week0 c++
Assignment week0 c++
 
Computer science ms
Computer science msComputer science ms
Computer science ms
 
6th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
6th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...6th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
6th Semester (Dec-2015; Jan-2016) Computer Science and Information Science En...
 
Comp 328 final guide
Comp 328 final guideComp 328 final guide
Comp 328 final guide
 
Oops Paper
Oops PaperOops Paper
Oops Paper
 
5th Semester (June; July-2015) Computer Science and Information Science Engin...
5th Semester (June; July-2015) Computer Science and Information Science Engin...5th Semester (June; July-2015) Computer Science and Information Science Engin...
5th Semester (June; July-2015) Computer Science and Information Science Engin...
 
C and data structure
C and data structureC and data structure
C and data structure
 
FP305 data structure PAPER FINAL SEM 3
FP305 data structure PAPER FINAL SEM 3FP305 data structure PAPER FINAL SEM 3
FP305 data structure PAPER FINAL SEM 3
 
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPERCLASS XII COMPUTER SCIENCE MONTHLY TEST  PAPER
CLASS XII COMPUTER SCIENCE MONTHLY TEST PAPER
 
Sample paper i.p
Sample paper i.pSample paper i.p
Sample paper i.p
 

Ähnlich wie Redo midterm

Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxmaxinesmith73660
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2Knowledge Center Computer
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqpB Bhuvanesh
 
Ds qb 2021 rma
Ds qb 2021 rmaDs qb 2021 rma
Ds qb 2021 rmaARAVINDRM2
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfahmed8651
 
CBSE XI COMPUTER SCIENCE
CBSE XI COMPUTER SCIENCECBSE XI COMPUTER SCIENCE
CBSE XI COMPUTER SCIENCEGautham Rajesh
 
Gate Previous Years Papers
Gate Previous Years PapersGate Previous Years Papers
Gate Previous Years PapersRahul Jain
 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptxJAYAPRIYAR7
 
Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002SANTOSH RATH
 
Dat 305 dat305 dat 305 education for service uopstudy.com
Dat 305 dat305 dat 305 education for service   uopstudy.comDat 305 dat305 dat 305 education for service   uopstudy.com
Dat 305 dat305 dat 305 education for service uopstudy.comULLPTT
 
1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professionalIsabella789
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdfahsaan3123
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdfahsaan3123
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docxrosemarybdodson23141
 
Technical aptitude questions_e_book1
Technical aptitude questions_e_book1Technical aptitude questions_e_book1
Technical aptitude questions_e_book1Sateesh Allu
 

Ähnlich wie Redo midterm (20)

Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqp
 
Ds qb 2021 rma
Ds qb 2021 rmaDs qb 2021 rma
Ds qb 2021 rma
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
 
Cs101 endsem 2014
Cs101 endsem 2014Cs101 endsem 2014
Cs101 endsem 2014
 
CBSE XI COMPUTER SCIENCE
CBSE XI COMPUTER SCIENCECBSE XI COMPUTER SCIENCE
CBSE XI COMPUTER SCIENCE
 
Doc 20180130-wa0005
Doc 20180130-wa0005Doc 20180130-wa0005
Doc 20180130-wa0005
 
Doc 20180130-wa0004-1
Doc 20180130-wa0004-1Doc 20180130-wa0004-1
Doc 20180130-wa0004-1
 
Gate Previous Years Papers
Gate Previous Years PapersGate Previous Years Papers
Gate Previous Years Papers
 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptx
 
Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002
 
Adobe
AdobeAdobe
Adobe
 
Dat 305 dat305 dat 305 education for service uopstudy.com
Dat 305 dat305 dat 305 education for service   uopstudy.comDat 305 dat305 dat 305 education for service   uopstudy.com
Dat 305 dat305 dat 305 education for service uopstudy.com
 
Cbse marking scheme 2006 2011
Cbse marking scheme 2006  2011Cbse marking scheme 2006  2011
Cbse marking scheme 2006 2011
 
1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdf
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdf
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
 
Technical aptitude questions_e_book1
Technical aptitude questions_e_book1Technical aptitude questions_e_book1
Technical aptitude questions_e_book1
 

Mehr von IIUM

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhostIIUM
 
Chapter 2
Chapter 2Chapter 2
Chapter 2IIUM
 
Chapter 1
Chapter 1Chapter 1
Chapter 1IIUM
 
Kreydle internship-multimedia
Kreydle internship-multimediaKreydle internship-multimedia
Kreydle internship-multimediaIIUM
 
03phpbldgblock
03phpbldgblock03phpbldgblock
03phpbldgblockIIUM
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice keyIIUM
 
Group p1
Group p1Group p1
Group p1IIUM
 
Tutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoTutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoIIUM
 
Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009IIUM
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lformsIIUM
 
Exercise on algo analysis answer
Exercise on algo analysis   answerExercise on algo analysis   answer
Exercise on algo analysis answerIIUM
 
Heaps
HeapsHeaps
HeapsIIUM
 
Report format
Report formatReport format
Report formatIIUM
 
Edpuzzle guidelines
Edpuzzle guidelinesEdpuzzle guidelines
Edpuzzle guidelinesIIUM
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam PaperIIUM
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam PaperIIUM
 
Group assignment 1 s21516
Group assignment 1 s21516Group assignment 1 s21516
Group assignment 1 s21516IIUM
 
Avl tree-rotations
Avl tree-rotationsAvl tree-rotations
Avl tree-rotationsIIUM
 
Week12 graph
Week12   graph Week12   graph
Week12 graph IIUM
 
Vpn
VpnVpn
VpnIIUM
 

Mehr von IIUM (20)

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhost
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Kreydle internship-multimedia
Kreydle internship-multimediaKreydle internship-multimedia
Kreydle internship-multimedia
 
03phpbldgblock
03phpbldgblock03phpbldgblock
03phpbldgblock
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice key
 
Group p1
Group p1Group p1
Group p1
 
Tutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoTutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seo
 
Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
 
Exercise on algo analysis answer
Exercise on algo analysis   answerExercise on algo analysis   answer
Exercise on algo analysis answer
 
Heaps
HeapsHeaps
Heaps
 
Report format
Report formatReport format
Report format
 
Edpuzzle guidelines
Edpuzzle guidelinesEdpuzzle guidelines
Edpuzzle guidelines
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam Paper
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam Paper
 
Group assignment 1 s21516
Group assignment 1 s21516Group assignment 1 s21516
Group assignment 1 s21516
 
Avl tree-rotations
Avl tree-rotationsAvl tree-rotations
Avl tree-rotations
 
Week12 graph
Week12   graph Week12   graph
Week12 graph
 
Vpn
VpnVpn
Vpn
 

Kürzlich hochgeladen

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Kürzlich hochgeladen (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

Redo midterm

  • 1. Page | 1 PART 1 – Multiple Choice Questions 1. Which of the following is FALSE about linked lists A. The data structure includes the link to another object of the same type B. The data set are stored in contiguous order in memory C. The size is dynamic during run-time D. Memory is allocated at run-time 2. The advantage of arrays over linked lists is A. Direct access B. Less memory usage C. Easier to implement D. Dynamic memory allocation 3. Which of the following structures is suitable to keep track of a sequence printing jobs sent to a network printer? A. Trees B. Stack C. Queues D. Lists 4. The following problems best solved using stack structures, EXCEPT A. Balancing of parenthesis B. Evaluation of postfix expressions C. Removal of items in random order D. Evaluation of functions containing recursive calls 5. Given the following sequence of operations performed on a stack: push (5.0), push (9.5), pop, push (27.5), push (12.7), push (0), pop, pop, push (31.2) What will be the sequence of items in the stack as a result? A. 31.2 0.0 12.7 27.5 9.5 5.0 B. 27.5 9.5 5.0 C. 3.12 27.5 5.0 D. Stack is empty
  • 2. Page | 2 6. Suppose myList is an object of List data structure, and myList.displayList() produces the following output: 28 7 76 48 70 What would be the output when the following statements are executed? myList.InsertNode(2, 10); myList.DisplayList(); A. 10 28 7 76 48 70 B. 28 7 76 10 48 70 C. 28 7 76 48 70 10 D. 28 7 10 76 48 70 7. Suppose an array myArr contains the following sequences of integers: 28 7 76 48 70 What would be resulting sequence of MyArr when the following statement is executed? myArr [2] = 10; A. 10 28 7 76 48 B. 28 7 76 10 48 C. 28 7 10 48 70 D. 7 10 76 48 70 8. Which of the following is FALSE when using recursion A. The recursions must be assumed to work all the time B. You must have a base case which can be solved without recursion C. The recursive call must always make progress towards the base case D. The recursive calls must always be compounded in multiple recursive calls 9. How many times will the symbol ‘#’ be printed by the call foo (4)? void foo (int i) { if (i > 1) { foo (i/2); foo (i/2); } cout << "#"; } A. 6 B. 7 C. 8 D. 9
  • 3. Page | 3 10. Which of the following statements about QUEUES is FALSE ? A. New items can only be inserted at the end position B. The items are processed in a queue on a First in First out basis C. The main operations of a queue is enqueueing and dequeueing D. Items cannot be removed from a queue at the beginning of queue 11. In linked lists, there are no NULL links in A. linear doubly linked list B. circular linked list C. single linked list D. All of the above 12. The range of 4-bits unsigned integer is between: A. 0 to 15 B. 1 to 16 C. -7 to 8 D. -15 to 14 13. When a new node is inserted in between a linked list, which of these is TRUE: A. nodes appearing after the new node needs to be moved B. nodes appearing before the new node needs to be moved C. nodes appearing before and after the new node need to be moved D. None of the above 14. One DIFFERENCE between a queue and a stack is: A. Queues require linked lists, but stacks require array B. Stacks require linked lists, but queues require array C. Queues use two ends of the structure; stacks use only one. D. Stacks use two ends of the structure; queues use only one. 15. The address of an element [i, j] in a m × n matrix based on the column-wise order can be ______ A. m * ( i – 2 ) + j B. m * ( j – 2 ) + i C. n* ( i – 1 ) + j D. n* ( i – 1) + (j – 1)
  • 4. Page | 4 PART 2 – Short Answer Questions 1. Given the following code: #include <iostream> using namespace std; int myfunction(int); int main () { int input, answer; cout <<"Enter an integer: "; cin >> input; answer = myfunction(input); cout << endl<<"The answer "<<input<< "! is " << answer; return 0; } int myfunction (int num) { cout <<"Fib " << num<< " is " ; if (num == 0) return 0; else (num == 1) return 1; else return myfunction (num-1) + myfunction (num-2); } Write the output of the program if the user types 4 as input? 2. Discuss the pros and cons of choosing linked list implementation for lists, stacks and queues. 3. Suppose a queue called myQueue is implemented using a circular array of MAXSIZE = 7. Illustrate to show the step-by-step effects in myQueue if the following sequence of statements is executed: myQueue.enqueue (‘F’) myQueue.enqueue (‘C’) myQueue.enqueue (‘Q’) myQueue.dequeue myQueue.enqueue (‘X’) myQueue.enqueue (‘Z’) myQueue.dequeue myQueue.enqueue (‘L’) myQueue.enqueue (‘S’) myQueue.enqueue (‘W’) myQueue.enqueue (‘C’) myQueue.dequeue
  • 5. Page | 5 4. In C++, a variable that stores integer values can be declared as short (2 bytes or 16 bits) or int (bytes or 32 bits). Furthermore, floating-point numbers can be declared as float (4 bytes or 32 bits) or double (8 bytes or 64 bits) based on the IEEE Standard for Floating Point Arithmetic (IEEE-754). Determine the corresponding binary values that are stored in the computer for the following variable declarations: a. unsigned short a = 15; b. short b = -15; c. float c = -52.25 5. Use stacks to show the step-by-step evaluation of the post-fix expression given below: 5.2 2.0 1.5 * + 4.0 2.0 2.0 ^ * - 6. Given below is a recursive method of function f for the value x. Write an equivalent program segment using iterative method. int f (int x){ if (x == 0) return 0; else return 2 * f (x – 1) + x * x; } 7. The elements in an array may be stored based on a row-wise or column-wise arrangement depending on the programming language used. Suppose the dimensions of an array myGoodArray are 7X9X8. Given the address of myGoodArray [4, z, 3] based on the column-wise method is 438, when the base address (B) is 10, with size of each element (W) is 2, and lowest index of each dimension is 0, a. Find z. b. Determine the address of the same element if it is implemented in row-wise method. 8. Write an algorithm which checks if the brackets in an expression are balanced and reports an error if the matching brackets is missing.