Grade 12 Programming Fundamentals Worksheet
This worksheet covers fundamental concepts in programming for Grade 12 students, including data types, control structures, and object-oriented programming principles.
Includes
Standards
Topics
Programming Fundamentals
Name:
Date:
Score:
Read each question carefully and answer to the best of your ability. Show all your work for coding-related questions.
1. Which of the following is NOT a fundamental data type in most programming languages?
Integer
Boolean
Array
String
2. What is the primary purpose of a 'for' loop in programming?
To define a function
To make a decision based on a condition
To iterate over a sequence of elements
To declare a variable
3. The concept of allows objects of different classes to be treated as objects of a common base class.
4. A is a set of instructions that tells a computer how to perform a specific task.
5. In object-oriented programming, refers to the bundling of data and methods that operate on the data within a single unit.
6. Python is an example of a compiled programming language.
True
False
7. An algorithm must always produce a correct output.
True
False
8. Briefly explain the difference between a high-level and a low-level programming language.
9. Describe the concept of 'inheritance' in object-oriented programming with an example.
10. Analyze the following Python code snippet. What will be the output?
```python def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) print(factorial(4)) ```
Explain your reasoning: