MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, they should be reordered as 4, 9, 16. Which of the following algorithms can be used to place any three numbers in the correct order?
A
If the first number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.
B
If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them.
C
If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the last number, swap them.
D
If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.
Explanation: 

Detailed explanation-1: -Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, they should be reordered as 4, 9, 16.

Detailed explanation-2: -Which of the following best describes the ability of parallel computing solutions to improve efficiency? Any problem that can be solved sequentially can be solved using a parallel solution in approximately half the time.

Detailed explanation-3: -For which of the following situations would it be best to use a heuristic in order to find a solution that runs in a reasonable amount of time? Finding the fastest route that visits every location among n locations, which requires n! possible routes be examined.

Detailed explanation-4: -Which of the following describes how the program should assign the four processes to optimize execution time? Processes W and Z should be assigned to one processor and processes X and Y should be assigned to the other processor.

There is 1 question to complete.