author | Amit Sethi |
Fri, 12 Nov 2010 02:29:04 +0530 | |
changeset 488 | 85f049b5ec08 |
parent 487 | cb3974daced5 |
permissions | -rw-r--r-- |
401 | 1 |
Objective Questions |
2 |
------------------- |
|
3 |
||
4 |
.. A mininum of 8 questions here (along with answers) |
|
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 | 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 | 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 | 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 | 46 |
|
47 |
||
487
cb3974daced5
Added questions and slides for testing and debugging
Amit Sethi
parents:
401
diff
changeset
|
48 |
|
401 | 49 |
|
50 |
||
51 |
Larger Questions |
|
52 |
---------------- |
|
53 |
||
54 |
.. A minimum of 2 questions here (along with answers) |
|
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 |