Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
10 views

Lecture 2 Exercises

Lecture 2 Exercises
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lecture 2 Exercises

Lecture 2 Exercises
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lecture 2 exercises

Name:………………………………………

Introduction to Programming and Python

1. What is the primary function of the Control Unit (CU) in a CPU?


o A) Perform mathematical operations
o B) Manage and coordinate computer operations
o C) Execute instructions
o D) Store data
2. Which unit of the CPU is specialized in performing mathematical and logical operations?
o A) Control Unit (CU)
o B) Arithmetic and Logic Unit (ALU)
o C) Memory Unit (MU)
o D) Input/Output Unit (IOU)
3. What does volatile memory do when the power is turned off?
o A) Retains its contents
o B) Erases its contents
o C) Doubles its capacity
o D) Converts to secondary storage
4. Which of the following is NOT a form of secondary storage?
o A) Hard Drive
o B) USB Drive
o C) Main Memory
o D) Solid State Drive (SSD)
5. What type of software is responsible for managing and controlling computer hardware?
o A) Application Software
o B) System Software
o C) Utility Software
o D) Firmware
6. Which language uses binary code (0s and 1s)?
o A) High-Level Language (HLL)
o B) Assembly Language
o C) Machine Language
o D) Pseudocode
7. What is a key characteristic of Assembly Language?
o A) Uses English-like syntax
o B) Machine-independent
o C) Uses mnemonics for instructions
o D) Easily portable
8. Which of the following is a High-Level Language (HLL)?
o A) Java
o B) Assembly
o C) Machine Language
o D) Binary Code
9. What is the main purpose of a compiler?
o A) Execute programs directly
o B) Translate High-Level code to machine code
o C) Store data
o D) Debug programs
10. What is the first step in the program development cycle?
o A) Design – Plan a Solution
o B) Analyze – Define the Problem
o C) Implement – Write Code
o D) Test – Check for Errors

Introduction to Python

11. Which of the following describes Python?


o A) Compiled Language
o B) Interpreted Language
o C) Assembly Language
o D) Machine Language
12. What makes Python a highly interactive language?
o A) Its ability to run on different platforms
o B) Its ability to execute code line by line
o C) Its complex syntax
o D) Its requirement for compilation
13. Why is Python considered a cross-platform language?
o A) It is compiled for each platform separately
o B) It runs seamlessly across different operating systems
o C) It uses machine-specific instructions
o D) It only works on Windows systems
14. Which feature of Python simplifies debugging?
o A) Complex syntax
o B) Manual memory management
o C) Built-in debugger
o D) High-level abstractions
15. What type of memory does Python manage automatically?
o A) Cache Memory
o B) Virtual Memory
o C) Secondary Storage
o D) Garbage Collection
16. Which library or plugin feature in Python helps in handling complex tasks?
o A) Basic libraries
o B) Extensive libraries and plugins
o C) External tools
o D) Machine-specific libraries
17. What is one of the main uses of Python in web development?
o A) Creating desktop applications
o B) Designing video games
o C) Building web applications using frameworks like Django
o D) Performing hardware diagnostics
18. Which library is used for game development in Python?
o A) Tkinter
o B) PyGame
o C) Flask
o D) Django
19. What is a key advantage of Python’s syntax?
o A) Complexity
o B) Readability and cleanliness
o C) Machine-dependence
o D) Lack of flexibility
20. Which of the following is NOT a characteristic of Python?
o A) Simple installation
o B) Cross-platform compatibility
o C) Complex syntax
o D) Readable and clean code

Syntax and Comments


21. In Python, which symbol is used to start a comment?
o A) #
o B) //
o C) --
o D) /*
22. What is the purpose of comments in Python code?
o A) To execute code
o B) To improve code readability
o C) To define variables
o D) To compile the code
23. How do you write a multi-line comment in Python?
o A) Using triple quotes (''' or """)
o B) Using multiple single-line comments
o C) Using a single-line comment with backslashes
o D) Python does not support multi-line comments
24. Which of the following statements about Python’s syntax is true?
o A) Python uses curly braces for code blocks
o B) Python uses indentation to define code blocks
o C) Python requires semicolons to end statements
o D) Python does not use indentation
25. What is the main benefit of Python's clean and easy syntax?
o A) Faster execution speed
o B) More complex programming
o C) Enhanced code readability
o D) Better hardware compatibility
26. Which of the following does NOT describe Python’s interactive mode?
o A) Allows quick testing
o B) Suitable for beginners
o C) Requires extensive code compilation
o D) Enables real-time experimentation
27. What is the role of Python's interpreter?
o A) Compile code into machine language
o B) Execute code line by line
o C) Store code in memory
o D) Convert code into binary
28. How does Python handle memory management?
o A) Manual memory allocation
o B) Garbage collection
o C) Static memory allocation
o D) Memory deallocation on demand
29. Which of the following is a Python framework for web development?
o A) PyGame
o B) Tkinter
o C) Django
o D) NumPy
30. Which Python library is used for creating desktop applications with graphical user interfaces?
o A) PyGame
o B) Django
o C) Tkinter
o D) Flask

General Programming Concepts

31. In the context of a program, what does the 'Fetch' operation involve?
o A) Executing an instruction
o B) Retrieving an instruction from memory
o C) Producing output data
o D) Storing data
32. What is a unique feature of secondary storage compared to main memory?
o A) It is volatile
o B) It has slower access speed
o C) It loses data when power is off
o D) It stores data temporarily
33. Which of the following is a type of input device?
o A) Monitor
o B) Printer
o C) Keyboard
o D) Disk Drive
34. What is a key feature of system software?
o A) Assists with specific tasks
o B) Manages and controls computer hardware
o C) Provides web development frameworks
o D) Enhances productivity with office tools
35. What is the main role of application software?
o A) Control hardware operations
o B) Manage memory
o C) Assist users with specific tasks
o D) Translate code into machine language
36. What does a flowchart's 'Decision' symbol represent?
o A) Start or end of a process
o B) A processing step
o C) A decision point with yes/no branches
o D) Input or output operations
37. What does the 'Processing' symbol in a flowchart indicate?
o A) Input or output operations
o B) Flow of logic
o C) A decision point
o D) A processing step with instructions
38. In a flowchart, what does the 'Connector' symbol do?
o A) Show the start or end of a task
o B) Indicate input or output operations
o C) Join flow lines
o D) Represent a processing step
39. What is the purpose of rounding in the algorithm for calculating the cost of sending a package?
o A) To ensure exact cost calculation
o B) To simplify the cost calculation
o C) To handle fractional units of weight
o D) To convert units from kilograms to pounds
40. Which of the following is NOT a key step in the program development cycle?
o A) Analyze – Define the Problem
o B) Design – Plan a Solution
o C) Implement – Write Code
o D) Execute – Run the Program

You might also like