A-Level Quiz - Arrays, Tuples, and Records PDF

Summary

This quiz covers arrays, tuples, and records in computer science, including their properties, data structures, and Python implementation.

Full Transcript

Teach Computer Science A-Level Arrays, tuples and records teachcomputerscience.co m Quiz 1. Complete this sentence: Arrays are ……………… data structures. A. Linear, homogenous and static B. Linear, homogenous and dynamic...

Teach Computer Science A-Level Arrays, tuples and records teachcomputerscience.co m Quiz 1. Complete this sentence: Arrays are ……………… data structures. A. Linear, homogenous and static B. Linear, homogenous and dynamic C. Non-linear, homogenous and static D. Non-linear, non-homogenous and dynamic 2. Which of the following is TRUE about arrays? A. Arrays store data in a certain order B. All data in an array are of the same data type C. Each element has a corresponding index value D. All of the above 3. Complete this sentence: ……………… module is initiated from Python library to work with arrays. A. array B. data structures C. index D. none of the above 3. Complete this sentence: Index of an array starts with ……………… A. 0 B. 1 C. -1 D. 2 teachcomputerscience.co m 5. An array number_of_students represents 10 students’ marks. Which of the following represents this array declaration? A. number_of_students=array('i', range(10)) B. number_of_students=array.array('i', range(1,10)) C. number_of_students=array.array('i', range(10)) D. None of the above 6. A program prompts the user to input values to an array. What programming structure is required for this? A. Case structures B. If… else…. C. Iteration D. None of the above 7. An array student mark consists of data: [90,85,70,75,80]. What is the output of print(student mark)? A. 70 B. 75 C. 80 8. A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of print(Array_2d)? A. [1, 2, 3, 4] B. [5, 6, 7, 8] C. [9, 10, 11, 12] teachcomputerscience.co m 9. A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of print(Array_2d)? A. 1 B. 2 C. 5 D. 6 10. Which of the following is used to separate a two- dimensional array into elements? A. for row in Array_name: for element in row: B. for column in Array_name: for element in column: C. for element in Array_name: D. None of the above 11. Which of the following is NOT an array? A. Numbers=[1,2,3,4,5] B. Subject=[“Maths”, “Science”, “Geography”, “History”, “7891”] C. Subject=[“Maths”, “Science”, “Geography”, “History”, 7891] 12. What is common between the elements of a homogeneous data structure? A. Format B. Data type C. Number of characters teachcomputerscience.co m 13. A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of len(print(Array_2d)? A. 2 B. 3 C. 4 D. 12 14. A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of len(print(Array_2d)? A. 1 B. 3 C. 4 D. 12 15. Which of the following is FALSE about an array? A. Arrays are static data structures. B. Elements of an array are of the same data type. C. Elements of an array cannot be modified. D. Arrays are of fixed length. 16. Which of the following is FALSE about records in databases? A. A record may consist of elements with different data types. B. The fields in a record are specified with their index as in a two-dimensional array. C. Elements in a record are related to each other. teachcomputerscience.co m 17. Which of the following is TRUE about tuples? A. Tuples represent elements of the same data type. B. Length of a tuple can be changed. C. A tuple is a dynamic data structure. D. Elements of a tuple cannot be modified. 18. Consider a tuple, fruits= (‘apple’, ‘orange’, ‘watermelon’, ‘grapes’, ‘banana’). What is the output for the statement print(fruits[-1])? A. Apple B. Orange C. Banana D. Error teachcomputerscience.co m

Use Quizgecko on...
Browser
Browser