Computer Science Concepts - Test 10 (Algorithms)


  1. Consider you are given a combination lock with three digits. You are told that the owner has forgotten the key, but he remembered that the three digits in the key are all less than 5.

    If you want to crack the key, in the worst case, how many different combinations do you need to try?

    1. 5

    2. 5*5

    3. 5*5*5

    4. 5*5*5*5

    check/hide answer

  2. Continuing from the last question. If the owner suddenly recalled that the sum of the three digits is "8". How do you express the knowledge about the key mathematically?

    1. X+Y+Z = 8

    2. X+Y+Z = 8 where 0<X<5, 0<Y<5, 0<Z<5

    3. X+Y+Z = 8 where 0=<X<5, 0=<Y<5, 0=<Z<5

    4. X+Y+Z = 8 where 0=<X<5, 0=<Y<5, 0=<Z<5 and X,Y,Z are integers.

    check/hide answer

  3. With the new knowledge, i.e. X+Y+Z=8, can you crack the key quicker?

    1. No

    2. Yes, it can be about 3 times quicker.

    3. Yes, it can be about 5 times quicker.

    4. Yes, it can be about 10 times quicker.

    check/hide answer

    
    
    
    
    
    
    
    

  4. In today's sorting example, what is the maximum stack size needed for performing this sorting algorithm? Assume that n is the length of the given list.

    1. log(n)

    2. 2*n

    3. n/2

    4. n

    check/hide answer

  5. When you are in a maze, which type of search algorithms should you use, breadth-first or depth-first?

    1. breadth-first

    2. depth-first

    3. either depth-first or beadth-first

    4. none of them

    check/hide answer


    Rong Yang,