testing-debugging/questions.rst
author Amit Sethi
Fri, 12 Nov 2010 02:01:28 +0530
changeset 487 cb3974daced5
parent 401 abf092be95ef
permissions -rw-r--r--
Added questions and slides for testing and debugging
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     1
Objective Questions
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     2
-------------------
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     3
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     4
.. A mininum of 8 questions here (along with answers)
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     5
487
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
     6
1. Why do we do Software Testing?
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
     7
   
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
     8
   Answer: To evaluate a program and determine that it meets required results.
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
     9
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    10
              
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    11
487
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    12
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    13
2. What is proper indentation for python code according to style guidelines?
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    14
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    15
   Answer: Four Space Indentation
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    16
   
487
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    17
3. What is the idiom used for running python scripts in a standalone manner?
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    18
   
487
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    19
   Answer: 
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    20
   if __name__ == '__main__':
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    21
     
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    22
4. What constitutes a test case?
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    23
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    24
   Answer: A set of inputs and expected result
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    25
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    26
5. How do you start the debugger on ipython?
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    27
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    28
   Answer: %debug
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    29
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    30
6. What idiom do you use for catching and exception?
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    31
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    32
   Answer: try,catch.
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    33
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    34
7. What kind of exception is 0/0?
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    35
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    36
   Answer Zero Division Error
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    37
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    38
8. a = 12.68
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    39
   b = 0.05
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    40
   c = round(a/b)
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    41
   d = c * b
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    42
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    43
   What would you recommend to the programmer who wrote
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    44
   above written piece of code.
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    45
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    46
   
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    47
487
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    48
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    49
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    50
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    51
Larger Questions
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    52
----------------
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    53
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    54
.. A minimum of 2 questions here (along with answers)
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    55
487
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    56
1. Write a program for checking if two numbers are coprime
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    57
   Create test cases for it and automate it.
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    58
2. Write a program that divides two numbers. Take the numbers from the user. Also make sure the code tell the user that input is invalid incase the divisor is 0.
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    59
cb3974daced5 Added questions and slides for testing and debugging
Amit Sethi
parents: 401
diff changeset
    60