TB1 Week 6
This week, completed a quiz on what I’ve learnt so far about python.
https://moodle.port.ac.uk/pluginfile.php/3804620/mod_resource/content/5/MoreQ.pdf
Q1: c (Because things like easier to read and more modular scripts are good, especially if they are compliant with client requirements, however self explanatory is not a good reason as the code should be clearly written and commented rather than assumed to be legible)
The answer is d
Q2: d (Because a function has to be called to return the value it has, it needs to use the return keyword to do so)
Q3: d (Because there is one too many closed brackets when y is being defined, returning a syntax error)
Answer actually isn’t there and it isn’t a syntax error it will just go through the function then return it again making 9*9, making the answer 3,81
Q4: b (As you need to order variables by making them equal something to their right, and the brackets will make sure the values are stored for u and v both?)
A and b are both correct
Q5: a (items are added to dictionaries by using dictname[“item”] = “itemname”)
Cannot use curly brackets for dictionary functions
Q6: d (This will check if x is less than y and the colon at the end is used to show the end of that line)
Q7: d (loop prints out only i then prints out the target which has been combined with the max i value)
Q8: a (As append does not remove items from a list, and because there are no syntax errors)
Q9: b (As there is no syntax error and the if statement is not true as y does not equal and is not greater than 30)
Q10: d (You can not mix integer and string values)
Q11: b (You use the #)
Q12: b (Using bidmas in the brackets before multiplying by 2)
Q13: d (Using bidmas again)
Q14: a (As it would become 14 while going through ex2 then be divided by 2 and returned)
Q15: c (As it would not be greater than 20 by the time it would have 2 added to it and printed making it 21, once it checks again whether or not a is greater than 20 it would fail breaking the loop)
It’s b, pay closer attention to the order of the print and the loop
Q16: c (Comments do not do anything to the actual code of the script)
Q17: d (It’s how it works)
Q18: c (it is going to the nested list and then using the 3rd element inside of it which is 8/4 which is 2)
Q19: b (break stops loops)
Q20: b (bidmas)
Programming for Animation Devblog
Status | Prototype |
Category | Other |
Author | Pomanchocho |
More posts
- TB1 Week 10Dec 05, 2022
- TB1 Week 9Dec 05, 2022
- TB1 Week 8Dec 05, 2022
- TB1 Week 7Dec 05, 2022
- TB1 Week 5Dec 05, 2022
- TB1 Week 4Dec 05, 2022
- TB1 Week 3Dec 05, 2022
- TB1 Week 2Dec 05, 2022
Leave a comment
Log in with itch.io to leave a comment.