CPP and DataStructures

Beschreibung

SecondYear Second Year Quiz am CPP and DataStructures, erstellt von Faheem Ahmed am 19/10/2017.
Faheem Ahmed
Quiz von Faheem Ahmed, aktualisiert more than 1 year ago
Faheem Ahmed
Erstellt von Faheem Ahmed vor mehr als 6 Jahre
640
0

Zusammenfassung der Ressource

Frage 1

Frage
Two main measures for the efficiency of an algorithm are
Antworten
  • Processor and memory
  • Complexity and capacity
  • Time and space
  • Data and space

Frage 2

Frage
The complexity of Binary search algorithm is
Antworten
  • O(n)
  • O(log n)
  • O(n^2)
  • O(n log n)

Frage 3

Frage
Which of the following data structure is not linear data structure?
Antworten
  • Arrays
  • Linked lists
  • Both
  • None

Frage 4

Frage
The complexity of merge sort algorithm is
Antworten
  • O(n)
  • O(log n)
  • O(n^2)
  • O(n log n)

Frage 5

Frage
When determining the efficiency of algorithm the time factor is measured by
Antworten
  • Counting microseconds
  • Counting the number of key operations
  • Counting the number of statements
  • Counting the kilobytes of algorithm

Frage 6

Frage
When determining the efficiency of algorithm, the space factor is measured by
Antworten
  • Counting the maximum memory needed by the algorithm
  • Counting the minimum memory needed by the algorithm
  • Counting the average memory needed by the algorithm
  • Counting the maximum disk space needed by the algorithm

Frage 7

Frage
Which of the following is not the internal sort?
Antworten
  • Insertion Sort
  • Bubble Sort
  • Merge Sort
  • Heap Sort

Frage 8

Frage
Given two sorted lists of size m and n respectively.The number of comparisons needed in the worst case by the merge sort algorithm will be?
Antworten
  • mn
  • max(m,n)
  • min(m,n)
  • m+n-1

Frage 9

Frage
To represent hierarchical relationship between elements, Which data structure is suitable?
Antworten
  • Tree
  • Graph
  • Queue
  • Stack

Frage 10

Frage
The postfix expression for * + a b - c d is?
Antworten
  • ab + cd - *
  • ab cd + - *
  • ab + cd * -
  • ab + - cd *

Frage 11

Frage
A circular queue is implemented using an array of size 10. The array index starts with 0, front is 6, and rear is 9. The insertion of next element takes place at the array index.
Antworten
  • 0
  • 7
  • 9
  • 10

Frage 12

Frage
Which type of traversal of binary search tree outputs the value in sorted order?
Antworten
  • Pre-order
  • In-order
  • Post-order
  • None

Frage 13

Frage
If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance?
Antworten
  • Insertion sort
  • Selection sort
  • Quick sort
  • Merge sort

Frage 14

Frage
The type of expression in which operator succeeds its operands is?
Antworten
  • Infix Expression
  • prefix Expression
  • postfix Expression
  • None

Frage 15

Frage
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
Antworten
  • AB+ CD*E - FG /**
  • AB + CD* E - F **G /
  • AB + CD* E - *F *G /
  • AB + CDE * - * F *G /

Frage 16

Frage
In linked list, pointer is pointing to the first element of the node then time require to insert element to second position is
Antworten
  • O(n)
  • O(1)
  • O(n^2)
  • O(n-1)

Frage 17

Frage
Time require to find any element of the linked list is
Antworten
  • O(n)
  • O(1)
  • None of these
  • O(n^2)

Frage 18

Frage
If start is pointing to first node of the linked list then consider the following statement - start = start->next; current = start->next; what will be the value of address field of current ?
Antworten
  • 5571
  • 5572
  • 3225
  • 2184

Frage 19

Frage
Consider the following linked list and following linked list representation - struct node { int data; struct node *next; }*start = NULL; what will be the value of following statement ? start->next->next->next->data
Antworten
  • 12
  • 30
  • 15
  • 25
  • 10

Frage 20

Frage
In Circular Linked List insertion of a node involves the modification of ____ links.
Antworten
  • 1
  • 2
  • 3
  • 4

Frage 21

Frage
If in a linked list address of first node is 1020 then what will be the address of node at 5th position ?
Antworten
  • 1036
  • 1028
  • 1025
  • None of these

Frage 22

Frage
Which of the following operation is performed more efficiently in doubly linked list ?
Antworten
  • Inserting a node at given position
  • None of these
  • Deleting a node at given position
  • Searching a node at given position

Frage 23

Frage
When new element is added in the middle of singly linked list then ________.
Antworten
  • Only elements that appear after the new element need to be moved
  • Only elements that appear before the new element need to be moved
  • No need to move element
  • Only elements that appear after the new element and before need to be moved

Frage 24

Frage
Consider linked list is used to implement the Stack then which of the following node is considered as Top of the Stack ?
Antworten
  • Any Node
  • Last Node
  • First Node
  • Middle Node

Frage 25

Frage
Consider the following linked list representation - struct node { int data; struct node *next; }start = NULL; struct node *new_node; Which of the following statement is used to create a node ?
Antworten
  • new_node=(struct node *)malloc((struct node));
  • new_node=(struct *)malloc(sizeof(struct node));
  • new_node=(struct node)malloc(sizeof(struct node));
  • new_node=(struct node *)malloc(sizeof(struct node));

Frage 26

Frage
Which of the following data structure is linear type?
Antworten
  • Strings
  • Lists
  • Queues
  • All of above

Frage 27

Frage
In a Heap tree
Antworten
  • Values in a node is greater than every value in left sub tree and smaller than right sub tree
  • Values in a node is greater than every value in children of it
  • Both of above conditions applies
  • None of above conditions applies

Frage 28

Frage
The order of an algorithm that finds whether a given Boolean function of 'n' variables, produces a 1 is
Antworten
  • linear
  • constant
  • exponential
  • logarithmic

Frage 29

Frage
A list integers is read in, one at a time, and a binary search tree is constructed. Next the tree is traversed would result in a printout which duplicates the original order of the list of integers?
Antworten
  • Inorder
  • Preorder
  • Postorder
  • None of these

Frage 30

Frage
A characteristic of the data that binary search uses but the linear search ignores, is
Antworten
  • Maximum value in the list
  • Minimum value in list
  • Length of the list
  • Order of the list

Frage 31

Frage
Queue can be used to implement
Antworten
  • recursion
  • radix sort
  • quick sort
  • depth first search

Frage 32

Frage
Which of the following sorting methods sorts a given set of items that is already in sorted order or in reverse sorted order with equal speed?
Antworten
  • Heap sort
  • Quick sort
  • Selection sort
  • Insertion sort

Frage 33

Frage
Suppose DATA array contains 1000000 elements. Using the binary search algorithm, one requires only about n comparisons to find the location of an item in the DATA array, then n is
Antworten
  • 7
  • 20
  • 38
  • 45

Frage 34

Frage
A sort which iteratively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called
Antworten
  • heap sort
  • quick sort
  • selection sort
  • insertion sort

Frage 35

Frage
The maximum number of comparisons needed to sort 7 items using radix sort is (assume each item is 4 digit decimal number)
Antworten
  • 23
  • 110
  • 280
  • 450

Frage 36

Frage
The postfix equivalent of the prefix * + a b - c d is
Antworten
  • ab+cd-*
  • ab + cd * -
  • ab + - cd *
  • ab cd + - *

Frage 37

Frage
A complete binary tree with the property that the value at each node is at least as large as the values at its children is called
Antworten
  • Heap
  • Binary Tree
  • Binary search tree
  • Completely balanced tree

Frage 38

Frage
A full binary tree with n leaves contains
Antworten
  • n nodes
  • log2n nodes
  • 2n+1 nodes
  • 2n - 1 nodes

Frage 39

Frage
Traversing a binary tree first root and then left and right subtrees called _______traversal.
Antworten
  • inorder
  • preorder
  • postorder
  • none of these

Frage 40

Frage
The number of nodes in a complete binary tree of level 5 is
Antworten
  • 10
  • 21
  • 63
  • 77

Frage 41

Frage
Number of possible binary trees with 3 nodes is
Antworten
  • 5
  • 7
  • 9
  • 11

Frage 42

Frage
A binary tree is generated by inserting in order the following integers: 50, 15, 62, 5, 20,58, 91, 3,8,37, 60, 24 The number of nodes in the left of the root respectively is
Antworten
  • (3,6)
  • (4,7)
  • (6,3)
  • (7,4)

Frage 43

Frage
The depth of a complete binary tree with n nodes is (log is to be base two)
Antworten
  • log(n)
  • log(n) + 1
  • log (n-1) + 1
  • log (n+1)-1

Frage 44

Frage
Which of the following are valid characters for a numeric literal constant?
Antworten
  • a comma ( , )
  • a dollar sign ($)
  • a percent sign (%)
  • None of the above

Frage 45

Frage
A default catch block catches
Antworten
  • all thrown objects
  • no thrown objects
  • any thrown object that has not been caught by an earlier catch block
  • all thrown objects that have been caught by an earlier catch block

Frage 46

Frage
When the compiler cannot differentiate between two overloaded constructors, they are called
Antworten
  • overloaded
  • destructed
  • ambiguous
  • dubious

Frage 47

Frage
When you pass a variable _____, C++ passes only the contents of the variable to the receiving function
Antworten
  • by reference
  • by value
  • globally
  • locally

Frage 48

Frage
Paying attention to the important properties while ignoring inessential details is known as________
Antworten
  • selectiveness
  • polymorphism
  • abstraction
  • summarizing

Frage 49

Frage
When you omit parameters from a function call, values can be provided by
Antworten
  • formal parameters
  • reference parameters
  • overloaded parameters
  • default parameters

Frage 50

Frage
The items listed in the function header are called _____
Antworten
  • actual arguments
  • formal parameters
  • passed parameters
  • sent arguments
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Bio Psyc Weeks 8-11: Emotion, Motivated Behaviours I: Reproductive Behaviours, Motivated Behaviours II – Sleep, Psychological Disorders
Karis Allen
The American Revolution
Ger McCabe Kelly
Supply-side Ecology
chloe allen
Developmental MCQ's
Karis Allen
WEEK 2 REVIEW QUESTIONS - EVOLUTIONARY THEORY
Emma Taurere
Disturbance
chloe allen
Biogenic Habitat & Engineers
chloe allen
plant and animal interactions
chloe allen
Aquaculture problems
chloe allen
government expenditure
sarah2013
Personality & Individual Differences Weeks 7-12
Karis Allen