Saturday, 19 August 2017

Data Structures and Algorithms Multiple Choice Questions - Set 3

21.       Which of the following algorithm is not stable?
(A) Bubble Sort
(B) Quick Sort
(C) Merge Sort
(D) Insertion Sort
Answer: B
22.       An algorithm that requires ................... operations to complete its task on n data elements is said to have a linear runtime.
(A) n3 + 9
(B) 3n2 + 3n + 2
(C) 2n + 1
(D) 9
Answer: C
23.       The in-order traversal of a binary tree is HFIEJGZ, and the post-order traversal of the same tree is HIFJZGE. What will be the total number of nodes in the left sub tree of the given tree? (It is NOT a search tree)
(A) 1
(B) 2
(C) 3
(D) 4
Answer: C
24.       The complexity of adding two matrices of order m*n is
(A) m + n
(B) mn
(C) max(m, n)
(D) min(m, n)
Answer: B
25.       Which method can find if two vertices x & y have path between them?
(A) Depth First Search
(B) Breadth First Search
(C) Both (A) & (B)
(D) None (A) or (B)
Answer: C
26.       If we choose Prim's Algorithm for uniquely weighted spanning tree instead of Kruskal's Algorithm, then
(A) we will get a different spanning tree.
(B) we will get the same spanning tree.
(C) spanning will have less edges.
(D) spanning will not cover all vertices.
Answer: B
Explanation
Regardless of which algorithm is used, in a graph with unique weight, resulting spanning tree will be same.
27.       The second largest number from a set of n distinct numbers can be found in
(A) O(n)
(B) O(2n)
(C) O(n2)
(D) O(log n)
Answer: A
28.       If the in-order and pre-order traversal of a binary tree are D,B,F,E,G,H,A,C and A,B,D,E,F,G,H,C respectively then the post-order traversal of that tree is
(A) D,F,G,A,B,C,H,E
(B) F,H,D,G,E,B,C,A
(C) C,G,H ,F,E,D,B,A
(D) D,F,H,G,E,B,C,A
Answer: D
29.       In a binary tree, the number of terminal or leaf nodes is 10. The number of nodes with two children is
(A) 9
(B) 11
(C) 25
(D) 20
Answer: A
30.    Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
(A) Insertion Sort
(B) Quick Sort
(C) Heap Sort
(D) Merge Sort
Answer: D

Friday, 18 August 2017

Data Structures and Algorithms Multiple Choice Questions - Set 2

11.       In order to get the information stored in a BST in the descending order, one should traverse it in which of the following order?
(A) left, root, right
(B) root, left, right
(C) right, root, left
(D) right, left, root
Answer: C
12.       The following sorting algorithms maintain two sub-lists, one sorted and one to be sorted:
(A) Selection Sort
(B) Insertion Sort
(C) Merge Sort
(D) both (A) and (B)
Answer: D
13.       What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
  if(head == NULL)
    return;
 
  fun1(head->next);
  printf("%d  ", head->data);
}
(A) Prints all nodes of linked lists
(B) Prints all nodes of linked list in reverse order
(C) Prints alternate nodes of Linked List
(D) Prints alternate nodes in reverse order
Answer: B
14.       Is it possible to create a doubly linked list using only one pointer with every node?
(A) Not Possible
(B) Yes, possible by storing XOR of current node and next node
(C) Yes, possible by storing XOR of addresses of previous and next nodes.
(D) Yes, possible by storing XOR of current node and previous node
Answer: C
15.       Every internal node in a B-tree of minimum degree 2 can have
(A) 2, 3 or 4 children
(B) 1, 2 or 3 children
(C) 2, 4 or 6 children
(D) 0, 2 or 4 children
Answer: B
16.       Which sorting algorithm is the best if the list is already in order?
(A) Quick sort
(B) Merge sort
(C) Insertion sort
(D) None of these
Answer: C
17.       In .............. the difference between the height of the left sub tree and height of right sub tree, for each node, is not more than one
(A) BST
(B) Complete Binary Tree
(C) AVL-tree
(D) Balanced Search tree
Answer: C
18.       If the array is already sorted, which of these algorithms will exhibit the best performance?
(A) Merge Sort
(B) Insertion Sort
(C) Quick Sort
(D) All of these
Answer: B
19.       Queue data structure works on ..............
(A) LIFO
(B) FIFO
(C) FILO
(D) None of these
Answer: B
20.    The number of comparisons required to sort 5 numbers in ascending order using bubble sort is
(A) 7
(B) 6
(C) 10
(D) 5
Answer: C

Thursday, 17 August 2017

Data Structures and Algorithms Multiple Choice Questions - Set 1

1.       In the deletion operation of max heap, the root is replaced by:
(A) next available value in the left sub-tree.
(B) next available value in the right sub-tree.
(C) first element of the last level
(D) last element of the last level
Answer: D
2.       Which of the following algorithm does not divide the list?
(A) merge sort
(B) binary search
(C) linear search
(D) quick sort
Answer: C
3.       At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary search algorithm?
(A) 10
(B) 15
(C) 20
(D) 30
Answer: A
4.       For implementing recursive function the data structure used is:
(A) Stack
(B) Queue
(C) Linked List
(D) Tree
Answer: A
Explanation:
For implementing recursive function, stack is used as a data structure.
5.       Which of the following is an example of in-place algorithm?
(A) Bubble Sort
(B) Merge Sort
(C) Insertion Sort
(D) None of the above
Answer: B
6.       The postfix form of the following infix notation is : (A + B)* (C*D − E)* F
(A) AB + CD*E − *F*
(B) AB+ CDE + − * F*
(C) AB+ CD − EF + − **
(D) ABCDEF* − + * +
Answer: A
7.       The number of nodes in a complete binary tree of depth d (with root at depth 0) is
(A) 2d−1 +1
(B) 2d+1 -1
(C) 2d−1 -1
(D) 2d+1 +1
Answer: B
8.       What are the sequence of popped out values if the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack.
(A) 2, 2, 1, 1, 2
(B) 2, 2, 1, 2, 2
(C) 2, 1, 2, 2, 1
(D) 2, 1, 2, 2, 2
Answer: A
9.       In conversion from prefix to postfix using stack data-structure, if operators and operands are pushed and popped exactly once, then the run-time complexity is ............
(A) Ο(1)
(B) Ο(n)
(C) Ο(log n)
(D) Ο(n2)
Answer: B
10.    The average case of quick sort has order
(A) O(n2)
(B) O(n)
(C) O(n log n)
(D) O(log n)
Answer: C

Thursday, 10 August 2017

CBSE UGC NET - 05 November, 2017 - NOTIFICATION

It  is  notified  that  CBSE  will  conduct  the  next UGC-NET  for  Junior  Research Fellowship & Eligibility for Assistant Professor on 05-11-2017 (Sunday). The candidates who desire  to  appear in the  test  may  see  the detailed  notification  available  on  the  website www.cbsenet.nic.in.

Important Dates
1. Submission of online application form: 11.08.2017
2. Last date for Applying Online: 11.09.2017
3. Last date of submission of Feethrough online generated Bankchallan, at any branch of(Syndicate/Canara/ICICI/HDFC Bank) or through credit/debit card: 12.09.2017
4. Correction in Particulars of application form on the website: 19th to 25th September, 2017
5. Date of Examination: 05.11.2017

C & C++ Programming Multiple Choice Questions - Set 51

1.       What will be the result of the expression 13 & 25?
(A) 38
(B) 25
(C) 9
(D) 12
Answer: C
2.       Which of the following operator can be overloaded through friend function?
(A) ->
(B) =
(C) ( )
(D) *
Answer: D
3.       Which of the following statement is valid?
(A) We can create new C++ operators.
(B) We can change the precedence of the C++ operators.
(C) We can change the associativity of the C++ operators.
(D) We can not change operator templates.
Answer: D
4.       What will be the output of the following program?
#include<iostream.h>
void main()
{
float x=5,y=2;
int result;
result=x % y;
cout<<result;
}
(A) 1
(B) 1.0
(C) Error message
(D) 2.5
Answer: C
5.       Which can be passed as an argument to a function?
(A) constant
(B) expression
(C) another function
(D) all of the above.
Answer: A
6.       While incrementing a pointer, its value gets increased by the length of the data type to which it points. This length is called
(A) scale factor
(B) length factor
(C) pointer factor
(D) increment factor
Answer: D
Explanation:
While incrementing a pointer, its value gets increased by the length of the data type to which it points.
7.       An integer constant in C must have ...................
(A) At least one digit
(B) At least one decimal point
(C) A comma along with digits
(D) Digits separated by commas
Answer: A
8.       A character variable can never store more than ...............
(A) 32 characters
(B) 8 characters
(C) 254 characters
(D) 1 character
Answer: D
9.       RunTime Polymorphism is achieved by .................
(A) friend function
(B) virtual function
(C) operator overloading
(D) function overloading
Answer: B
10.    A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is ...............
(A) call by name
(B) call by value
(C) call by reference
(D) call by value result
Answer: B

Wednesday, 9 August 2017

C & C++ Programming Multiple Choice Questions - Set 50

1.       What will be the output of following program?
#include<iostream.h>
void main()
{
float x;
x=(float)9/2;
cout<<x;
}
(A) 4.5
(B) 4.0
(C) 4
(D) 5
Answer: A
2.       A white space is :
(A) blank space
(B) new line
(C) tab
(D) all of the above
Answer: D
3.       The following can be declared as friend in a class
(A) an object
(B) a class
(C) a public data member
(D) a private data member
Answer: B
4.       What would be the output of the following?
#include<iostream.h>
void main()
{
char *ptr=“abcd”
char ch;
ch = ++*ptr++;
cout<<ch;
}
(A) a
(B) b
(C) c
(D) d
Answer: B
5.       A copy constructor takes
(A) no argument
(B) one argument
(C) two arguments
(D) arbitrary no. of arguments
Answer: B
6.       Overloading a postfix increment operator by means of a member function takes
(A) no argument
(B) one argument
(C) two arguments
(D) three arguments
Answer: A
7.       Which of the following ways are legal to access a class data member using this pointer?
(A) this.x
(B) *this.x
(C) *(this.x)
(D) (*this).x
Answer: D
8.       If a=8 and b=15 then the statement
x= (a>b) ? a:b;
(A) assigns a value 8 to x
(B) gives an error message
(C) assigns a value 15 to x
(D) assigns a value 7 to x
Answer: C
9.       What is the output of the following code
int n=0, m;
for (m=1; m<=n+1; m++)
printf(“%d”, m);
(A) 2
(B) 1
(C) 0
(D) 6
Answer: B
10.    In the following code fragment
int x, y = 2, z, a;
x=(y*=2) + (z=a=y);
printf (‘%d’,x);
(A) prints 8
(B) prints 6
(C) prints 6 or 8 depending on the compiler
(D) is syntactically wrong
Answer: A
Explanation:
It will print 8 because x=(y*=2)+(z=a=y)=4+4=8.