CPP and DataStructures

Descripción

SecondYear Second Year Test sobre CPP and DataStructures, creado por Faheem Ahmed el 19/10/2017.
Faheem Ahmed
Test por Faheem Ahmed, actualizado hace más de 1 año
Faheem Ahmed
Creado por Faheem Ahmed hace más de 6 años
640
0

Resumen del Recurso

Pregunta 1

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

Pregunta 2

Pregunta
The complexity of Binary search algorithm is
Respuesta
  • O(n)
  • O(log n)
  • O(n^2)
  • O(n log n)

Pregunta 3

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

Pregunta 4

Pregunta
The complexity of merge sort algorithm is
Respuesta
  • O(n)
  • O(log n)
  • O(n^2)
  • O(n log n)

Pregunta 5

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

Pregunta 6

Pregunta
When determining the efficiency of algorithm, the space factor is measured by
Respuesta
  • 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

Pregunta 7

Pregunta
Which of the following is not the internal sort?
Respuesta
  • Insertion Sort
  • Bubble Sort
  • Merge Sort
  • Heap Sort

Pregunta 8

Pregunta
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?
Respuesta
  • mn
  • max(m,n)
  • min(m,n)
  • m+n-1

Pregunta 9

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

Pregunta 10

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

Pregunta 11

Pregunta
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.
Respuesta
  • 0
  • 7
  • 9
  • 10

Pregunta 12

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

Pregunta 13

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

Pregunta 14

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

Pregunta 15

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

Pregunta 16

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

Pregunta 17

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

Pregunta 18

Pregunta
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 ?
Respuesta
  • 5571
  • 5572
  • 3225
  • 2184

Pregunta 19

Pregunta
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
Respuesta
  • 12
  • 30
  • 15
  • 25
  • 10

Pregunta 20

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

Pregunta 21

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

Pregunta 22

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

Pregunta 23

Pregunta
When new element is added in the middle of singly linked list then ________.
Respuesta
  • 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

Pregunta 24

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

Pregunta 25

Pregunta
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 ?
Respuesta
  • 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));

Pregunta 26

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

Pregunta 27

Pregunta
In a Heap tree
Respuesta
  • 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

Pregunta 28

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

Pregunta 29

Pregunta
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?
Respuesta
  • Inorder
  • Preorder
  • Postorder
  • None of these

Pregunta 30

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

Pregunta 31

Pregunta
Queue can be used to implement
Respuesta
  • recursion
  • radix sort
  • quick sort
  • depth first search

Pregunta 32

Pregunta
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?
Respuesta
  • Heap sort
  • Quick sort
  • Selection sort
  • Insertion sort

Pregunta 33

Pregunta
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
Respuesta
  • 7
  • 20
  • 38
  • 45

Pregunta 34

Pregunta
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
Respuesta
  • heap sort
  • quick sort
  • selection sort
  • insertion sort

Pregunta 35

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

Pregunta 36

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

Pregunta 37

Pregunta
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
Respuesta
  • Heap
  • Binary Tree
  • Binary search tree
  • Completely balanced tree

Pregunta 38

Pregunta
A full binary tree with n leaves contains
Respuesta
  • n nodes
  • log2n nodes
  • 2n+1 nodes
  • 2n - 1 nodes

Pregunta 39

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

Pregunta 40

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

Pregunta 41

Pregunta
Number of possible binary trees with 3 nodes is
Respuesta
  • 5
  • 7
  • 9
  • 11

Pregunta 42

Pregunta
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
Respuesta
  • (3,6)
  • (4,7)
  • (6,3)
  • (7,4)

Pregunta 43

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

Pregunta 44

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

Pregunta 45

Pregunta
A default catch block catches
Respuesta
  • 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

Pregunta 46

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

Pregunta 47

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

Pregunta 48

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

Pregunta 49

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

Pregunta 50

Pregunta
The items listed in the function header are called _____
Respuesta
  • actual arguments
  • formal parameters
  • passed parameters
  • sent arguments
Mostrar resumen completo Ocultar resumen completo

Similar

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