click below
click below
Normal Size Small Size show me how
IT0011
Integrative Programming and Technologies
| Question | Answer |
|---|---|
| Tuples are immutable. | ✅ True |
| a tuple is a collection which is ordered and unchangeable. | ✅ True |
| tuples are mutable. | ✅ False |
| List is a collection which is ordered and unchangeable. | ✅ False |
| A dictionary is a collection which is unordered, changeable and indexed. | ✅ False |
| In Python, sets are written with curly brackets. | ✅ True |
| The del keyword will delete the set completely. | ✅ True |
| The copy() method returns a copy of the dictionary. | ✅ True |
| Sets are unordered. | ✅ True |
| Given the code: aTuple = (10,20,30,40,50); print(aTuple[2:4]) | ✅ (30, 40) |
| Given the code: aTuple = (10,20,30,40,50); print(aTuple[:4]) | ✅ (10, 20, 30, 40) |
| Given the code: aTuple = (100,200,300,400,500); print(aTuple[-3:-1]) | ✅ (300, 400) |
| Given the code: x = list(('abc', 23, (78,16), 3.14, [1,2,3,4])); print(x[-1][-2]) | ✅ 3 |
| Given the code: nums = set([1,1,2,3,3,3,4,4]); print(len(nums)) | ✅ 4 |
| Given the code: d = {"john":40, "peter":45}; "john" in d | ✅ True |
| Which of the following is incorrect for t = (1,2,4,3)? | ✅ t[3] = 45 |
| What method is used to determine how many items a dictionary has? | ✅ len() |
| What method returns a list of all values in a dictionary? | ✅ values() |
| Which of these about a set is NOT true? | ✅ Allows duplicate values |
| When slicing a string the return value is a range of characters | ✅ True |
| An example of an illegal character is a double quote inside a string that is surrounded by double quotes | ✅ True |
| Given the code: a = “Learning, Python!” print(a[2:6]) What will be the output? | ✅ arni |
| The lower() method removes any whitespace from the beginning or the end | ✅ False |
| Given the code: a = ‘the quick brown fox’ print(‘fox’ in a) What will be the output? | ✅ true |
| Given the code: a = “Learning, Python!” print(a.split(“,”)) What will be the output? | ✅ ['Learning', ' Python!'] |
| Given the code: a = ‘the quick brown fox’ print(a.upper()) What will be the output? | ✅ THE QUICK BROWN FOX |
| The strip() method removes any whitespace from the beginning or the end | ✅ True |
| Given the code: b = “Learning” print(len(b)) What will be the output? | ✅ 8 |
| When slicing a string the return value is a range of data types | ✅ False |
| To open a file in binary format, add “a” to the mode parameter | ✅ False |
| The writelines() method is used to save the contents of a list object in a file | ✅ True |
| The readline() method reads the characters starting from the current reading position up to a newline character | ✅ True |
| The read(chars) method reads the specified number of characters starting from the current position | ✅ True |
| Which of the following is an incorrect file handling mode in Python? | ✅ rz |
| Which of the following is used to open a file for both writing and reading? | ✅ r+ |
| “rb” mode opens the file in binary format for writing | ✅ False |
| “wb” mode opens the file in binary format for reading | ✅ False |
| A file method used to read characters up to a newline character | ✅ readline() |
| Which of the following is used to open a file for appending? | ✅ a |