## Buy/Download all MCQ Ebook
>>>**Click Here**<<<

## Generating Permutations Multiple choice Questions and Answers (MCQs)

## Click on any option to know the CORRECT ANSWERS

Question 1 |

The dictionary ordering of elements is known as?

Lexicographical order | |

Colexicographical order | |

Well order | |

Sorting |

Question 1 Explanation:

Lexicographical order is also known as dictionary order. It is a generalized method of the way words are alphabetically ordered in a dictionary.

Question 2 |

How many permutations will be formed from the array arr={1, 2, 3}?

2 | |

4 | |

6 | |

8 |

Question 2 Explanation:

No.of permutations for an array of size n will be given by the formula nPn. So for the given problem, we have 3P3=6 or 3!=6.

Question 3 |

What will be the lexicographical order of permutations formed from the array arr={1, 2, 3}?

{{2, 1, 3}, {3, 2, 1}, {3, 1, 2}, {2, 3, 1}, {1, 2, 3}, {1, 3, 2}} | |

{{1, 2, 3}, {1, 3, 2}, {2, 3, 1}, {2, 1, 3}, {3, 2, 1}, {3, 1, 2}} | |

{{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}} | |

{{2, 1, 3}, {3, 1, 2}, {3, 2, 1}, {2, 3, 1}, {1, 2, 3}, {1, 3, 2}} |

Question 3 Explanation:

The number of permutations for the problem will be 6 according to the formula 3P3. When ordered in lexicographical manner these will be {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}.

Question 4 |

What is the name given to the algorithm depicted in the pseudo code below?

procedure generate(n : integer, Arr : array): if n = 1 then output(Arr) else for i = 0; i <= n - 2; i ++ do generate(n - 1, Arr) if n is even then swap(Arr[i], Arr[n-1]) else swap(Arr[0], Arr[n-1]) end if end for generate(n - 1, Arr ) end if

bubble sort | |

heap sort | |

heap's algorithm | |

Prim's algorithm |

Question 4 Explanation:

The given algorithm is called Heap's algorithm. It is used for generating permutations of a given list.

Question 5 |

Heap's algorithm requires an auxiliary array to create permutations.

true | |

false |

Question 5 Explanation:

Heap's algorithm does not require any extra array for generating permutations. Thus it is able to keep its space requirement to a very low level. This makes it preferable algorithm for generating permutations.

There are 5 questions to complete.