Practice 50 exam-oriented MCQs from Programming Fundamentals for Class 12 Computer Science. The questions cover programming paradigms, Python object-oriented programming, lists, dictionaries, nested lists, file handling, databases, normalization, and testing and debugging.
1. Which paradigm organizes software around objects containing data and behavior?
A) Object-oriented programming B) Functional programming C) Markup programming D) Linear programming
2. What is a main purpose of programming language paradigms?
A) Reduce complexity and make code easier to understand B) Increase file size C) Remove variables D) Prevent testing
3. What is an object in OOP?
A) An instance of a class with state and behavior B) A database server C) A source-code comment D) A compiler
4. What defines the structure and behavior of objects in Python OOP?
A) A class B) A loop C) A comment D) A text file
5. What does an instance attribute usually represent?
A) State or data associated with an object B) Compiler name C) Database server D) File extension
6. Which paradigm emphasizes computation in terms of functions?
A) Functional programming B) Object-oriented programming C) Markup programming D) Assembly only
7. A benefit of OOP is that it can:
A) Organize complex software into reusable classes and objects B) Eliminate algorithms C) Prevent all errors D) Remove data
8. A possible disadvantage of OOP is:
A) Additional design complexity for simple problems B) Inability to use variables C) Inability to represent data D) No possibility of reuse
9. Why may different paradigms be selected for different problems?
A) They have different strengths and design approaches B) They always produce identical designs C) Paradigms affect only fonts D) Paradigms are file formats
10. Which Python keyword starts a class definition?
A) class B) object C) define D) struct
11. What is the purpose of a method in a Python class?
A) Define behavior associated with class objects B) Store the operating system C) Create a hard disk D) Replace the interpreter
12. Which parameter commonly refers to the current instance in a Python method?
A) self B) current C) thisfile D) instanceonly
13. Creating an object from a class produces:
A) An instance of that class B) A new database C) A compiler D) A new programming paradigm
14. Which feature helps an object maintain its state?
A) Comments B) Instance attributes C) Whitespace D) File extensions
15. What is the primary purpose of a Python list?
A) Store only key-value pairs B) Store an ordered collection of elements C) Store only database tables D) Store only functions
16. Which expression is a Python list?
A) {1:2, 3:4} B) [1, 2, 3] C) (1:2:3) D) <1,2,3>
17. A Python dictionary stores:
A) Only comments B) Key-value pairs C) Only machine instructions D) Only graphics
18. Which is a valid one-item Python dictionary?
A) [name = Ali] B) {‘name’: ‘Ali’} C) (name -> Ali) D)
19. Why is dictionary lookup by key often efficient?
A) Lists cannot contain numbers B) It is designed for key-based lookup C) Dictionaries cannot store data D) Lists are always on disk
20. What is a nested list?
A) A dictionary without keys B) A list containing another list C) A database inside a file D) A class without methods
21. Which is a nested list?
A) [1,2,3,4] B) [[1,2],[3,4]] C) {1,2,3,4} D) (1,2,3,4)
22. A list as a dictionary value is useful when a key represents:
A) Only a file extension B) Multiple related values C) Only one keyword D) Only one character
23. Which operation can be performed on a Python list?
A) Starting a database server B) Appending an element C) Compiling Python D) Changing the operating system
24. Which list method adds an item to the end?
A) addkey() B) append() C) pushitem() D) extendfile()
25. What does list indexing allow?
A) Creating a database B) Accessing an element by position C) Creating a class automatically D) Starting Python
26. What is a tuple?
A) A database connection B) An ordered collection that is generally immutable C) A breakpoint D) A class constructor only
27. What is a set mainly used for?
A) Writing files only B) Storing key-value pairs only C) Maintaining a collection of unique elements D) Defining classes only
28. Which Python structure is directly associated with key-value access?
A) Set B) Tuple C) Dictionary D) String
29. A list of lists is suitable for representing:
A) A debugger breakpoint B) Only one Boolean value C) Rows and columns of related values D) A class name only
30. What does disk I/O mean?
A) Only screen output B) Only keyboard input C) Input and output operations involving storage D) Only CPU arithmetic
31. Why is file handling important?
A) It converts Python to Java B) It removes variables C) It permits persistent data to be created, read, and written D) It prevents every error
32. Which mode opens a text file for reading?
A) ‘z’ B) ‘x’ C) ‘r’ D) ‘p’
33. Which mode commonly writes to a file, replacing existing content?
A) ‘q’ B) ‘r’ C) ‘w’ D) ‘s’
34. Which Python function is commonly used to open a file?
A) readfile() B) storage() C) open() D) file.start()
35. What is a database primarily used for?
A) Replacing Python classes B) Drawing interfaces only C) Organized storage and retrieval of data D) Debugging without code
36. Which database tool is mentioned in the curriculum?
A) Calculator B) Paint C) MySQL D) Notepad
37. What is the purpose of a primary key?
A) Start a loop B) Format source code C) Uniquely identify records in a table D) Name the database file
38. What does database normalization help achieve?
A) More Python keywords B) A faster monitor C) A well-structured database with reduced unnecessary redundancy D) Larger images
39. What is Third Normal Form?
A) A debugging window B) A Python loop C) A file mode D) A stage of relational database normalization
40. Connecting Python to a database allows a program to:
A) Replace every table with a list B) Disable all queries C) Remove all data D) Work with stored database data programmatically
41. What is a unit test?
A) A compression method B) A network test only C) A normalization form D) A test of a small unit such as a function
42. What is the purpose of a breakpoint?
A) Convert a list to a tuple B) Delete a program C) Create a database table D) Pause execution so program state can be examined
43. What does a watch help inspect during debugging?
A) Source-code font B) Computer clock only C) Disk capacity only D) Variable or expression values
44. Why is debugging useful?
A) It converts Python into SQL B) It writes the whole program automatically C) It removes testing D) It helps analyze and locate problems while code runs
45. Which simple technique can help locate a Python bug?
A) Renaming the operating system B) Deleting all variables C) Changing the monitor D) Using print statements to inspect values
46. A unit test for a function should check:
A) Whether Python is installed elsewhere B) Whether a monitor is connected C) Whether a database has a password D) Whether expected results are produced for selected inputs
47. If a program gives an unexpected result, a suitable approach is to:
A) Change the file extension B) Ignore the result C) Delete the source code D) Test the relevant function and inspect intermediate values
48. Which sequence is a sensible basic debugging process?
A) Never retest B) Delete, reinstall, and guess C) Change every variable at once D) Reproduce, inspect, identify the cause, fix, and retest
49. Why are unit tests useful after modifying code?
A) They normalize databases automatically B) They guarantee zero bugs C) They replace all debugging D) They can detect whether tested behavior still works
50. Which combination is explicitly named as advanced testing/debugging techniques?
A) Printers, scanners, and monitors B) Loops, comments, and operators C) HTML, CSS, and SQL D) Unit tests, breakpoints, and watches
This chapter is prepared with reference to the FBISE HSSC-II Computer Science Assessment Framework and the National Curriculum of Pakistan. It covers programming paradigms and Python OOP (CS-12-C-01), advanced programming constructs including lists, dictionaries, file handling and databases (CS-12-C-02), complex algorithms using lists and nested structures (CS-12-C-03), and advanced testing and debugging techniques such as unit tests, breakpoints and watches (CS-12-C-04).