CPP and DataStructures

Descrição

SecondYear Second Year Quiz sobre CPP and DataStructures, criado por Faheem Ahmed em 19-10-2017.
Faheem Ahmed
Quiz por Faheem Ahmed, atualizado more than 1 year ago
Faheem Ahmed
Criado por Faheem Ahmed mais de 6 anos atrás
640
0

Resumo de Recurso

Questão 1

Questão
Two main measures for the efficiency of an algorithm are
Responda
  • Processor and memory
  • Complexity and capacity
  • Time and space
  • Data and space

Questão 2

Questão
The complexity of Binary search algorithm is
Responda
  • O(n)
  • O(log n)
  • O(n^2)
  • O(n log n)

Questão 3

Questão
Which of the following data structure is not linear data structure?
Responda
  • Arrays
  • Linked lists
  • Both
  • None

Questão 4

Questão
The complexity of merge sort algorithm is
Responda
  • O(n)
  • O(log n)
  • O(n^2)
  • O(n log n)

Questão 5

Questão
When determining the efficiency of algorithm the time factor is measured by
Responda
  • Counting microseconds
  • Counting the number of key operations
  • Counting the number of statements
  • Counting the kilobytes of algorithm

Questão 6

Questão
When determining the efficiency of algorithm, the space factor is measured by
Responda
  • 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

Questão 7

Questão
Which of the following is not the internal sort?
Responda
  • Insertion Sort
  • Bubble Sort
  • Merge Sort
  • Heap Sort

Questão 8

Questão
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?
Responda
  • mn
  • max(m,n)
  • min(m,n)
  • m+n-1

Questão 9

Questão
To represent hierarchical relationship between elements, Which data structure is suitable?
Responda
  • Tree
  • Graph
  • Queue
  • Stack

Questão 10

Questão
The postfix expression for * + a b - c d is?
Responda
  • ab + cd - *
  • ab cd + - *
  • ab + cd * -
  • ab + - cd *

Questão 11

Questão
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.
Responda
  • 0
  • 7
  • 9
  • 10

Questão 12

Questão
Which type of traversal of binary search tree outputs the value in sorted order?
Responda
  • Pre-order
  • In-order
  • Post-order
  • None

Questão 13

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

Questão 14

Questão
The type of expression in which operator succeeds its operands is?
Responda
  • Infix Expression
  • prefix Expression
  • postfix Expression
  • None

Questão 15

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

Questão 16

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

Questão 17

Questão
Time require to find any element of the linked list is
Responda
  • O(n)
  • O(1)
  • None of these
  • O(n^2)

Questão 18

Questão
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 ?
Responda
  • 5571
  • 5572
  • 3225
  • 2184

Questão 19

Questão
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
Responda
  • 12
  • 30
  • 15
  • 25
  • 10

Questão 20

Questão
In Circular Linked List insertion of a node involves the modification of ____ links.
Responda
  • 1
  • 2
  • 3
  • 4

Questão 21

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

Questão 22

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

Questão 23

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

Questão 24

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

Questão 25

Questão
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 ?
Responda
  • 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));

Questão 26

Questão
Which of the following data structure is linear type?
Responda
  • Strings
  • Lists
  • Queues
  • All of above

Questão 27

Questão
In a Heap tree
Responda
  • 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

Questão 28

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

Questão 29

Questão
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?
Responda
  • Inorder
  • Preorder
  • Postorder
  • None of these

Questão 30

Questão
A characteristic of the data that binary search uses but the linear search ignores, is
Responda
  • Maximum value in the list
  • Minimum value in list
  • Length of the list
  • Order of the list

Questão 31

Questão
Queue can be used to implement
Responda
  • recursion
  • radix sort
  • quick sort
  • depth first search

Questão 32

Questão
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?
Responda
  • Heap sort
  • Quick sort
  • Selection sort
  • Insertion sort

Questão 33

Questão
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
Responda
  • 7
  • 20
  • 38
  • 45

Questão 34

Questão
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
Responda
  • heap sort
  • quick sort
  • selection sort
  • insertion sort

Questão 35

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

Questão 36

Questão
The postfix equivalent of the prefix * + a b - c d is
Responda
  • ab+cd-*
  • ab + cd * -
  • ab + - cd *
  • ab cd + - *

Questão 37

Questão
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
Responda
  • Heap
  • Binary Tree
  • Binary search tree
  • Completely balanced tree

Questão 38

Questão
A full binary tree with n leaves contains
Responda
  • n nodes
  • log2n nodes
  • 2n+1 nodes
  • 2n - 1 nodes

Questão 39

Questão
Traversing a binary tree first root and then left and right subtrees called _______traversal.
Responda
  • inorder
  • preorder
  • postorder
  • none of these

Questão 40

Questão
The number of nodes in a complete binary tree of level 5 is
Responda
  • 10
  • 21
  • 63
  • 77

Questão 41

Questão
Number of possible binary trees with 3 nodes is
Responda
  • 5
  • 7
  • 9
  • 11

Questão 42

Questão
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
Responda
  • (3,6)
  • (4,7)
  • (6,3)
  • (7,4)

Questão 43

Questão
The depth of a complete binary tree with n nodes is (log is to be base two)
Responda
  • log(n)
  • log(n) + 1
  • log (n-1) + 1
  • log (n+1)-1

Questão 44

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

Questão 45

Questão
A default catch block catches
Responda
  • 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

Questão 46

Questão
When the compiler cannot differentiate between two overloaded constructors, they are called
Responda
  • overloaded
  • destructed
  • ambiguous
  • dubious

Questão 47

Questão
When you pass a variable _____, C++ passes only the contents of the variable to the receiving function
Responda
  • by reference
  • by value
  • globally
  • locally

Questão 48

Questão
Paying attention to the important properties while ignoring inessential details is known as________
Responda
  • selectiveness
  • polymorphism
  • abstraction
  • summarizing

Questão 49

Questão
When you omit parameters from a function call, values can be provided by
Responda
  • formal parameters
  • reference parameters
  • overloaded parameters
  • default parameters

Questão 50

Questão
The items listed in the function header are called _____
Responda
  • actual arguments
  • formal parameters
  • passed parameters
  • sent arguments

Semelhante

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