Here are the student-style answers for your exam questions:
1. Define problem solving in computing. (Remembering) (CO1)
Problem solving in computing is the process of identifying a problem and finding a solution using computer programs. It involves breaking down complex problems into smaller, manageable parts that can be solved step by step. A programmer analyzes the problem, designs a solution, and then writes code to implement that solution. This is the main skill needed in programming and software development.
2. List the steps involved in developing an algorithm. (Remembering) (CO1)
The steps involved in developing an algorithm are:
- Understand and analyze the problem clearly
- Break down the problem into smaller parts
- Design the step-by-step solution
- Write the algorithm using simple statements
- Test the algorithm with sample inputs
- Refine and improve the algorithm if needed
3. Identify the symbols commonly used in flowcharts. (Remembering) (CO1)
Common flowchart symbols include:
- Oval: Start and Stop
- Rectangle: Process or action steps
- Diamond: Decision making (Yes/No questions)
- Parallelogram: Input and Output operations
- Circle: Connector to join flowchart parts
- Arrow: Shows direction of flow
4. State the difference between pseudocode and flowcharts. (Understanding) (CO1)
| Pseudocode | Flowcharts |
|---|---|
| Written in simple English-like statements | Uses symbols and shapes |
| Text-based representation | Visual/graphical representation |
| Easier to write quickly | Takes more time to draw |
| Good for complex logic | Better for simple processes |
| No standard symbols needed | Uses standard symbols |
| Can be converted to code easily | Need to interpret symbols first |
| Less visual appeal | More visual and easy to understand |
5. Explain the purpose of indentation in Python. (Understanding) (CO1)
Indentation in Python is used to define code blocks and show the structure of the program. Unlike other languages that use curly braces, Python uses spaces or tabs to group related statements together. It helps identify which statements belong to loops, conditions, or functions. Proper indentation makes the code readable and is required for the program to run correctly.
6. Describe the role of tokens in Python programming. (Understanding) (CO1)
Tokens are the smallest individual units in a Python program that have meaning to the interpreter. They include keywords, identifiers, literals, operators, and delimiters. Python breaks down the entire program into these tokens during execution. Each token serves a specific purpose like storing data, performing operations, or controlling program flow. Understanding tokens helps in writing correct Python syntax.
7. Classify the basic data types available in Python. (Understanding) (CO1)
| Data Type | Description | Example |
|---|---|---|
| Integer (int) | Whole numbers | 25, -10 |
| Float | Decimal numbers | 3.14, -2.5 |
| String (str) | Text data | "Hello", 'Python' |
| Boolean (bool) | True or False values | True, False |
| List | Ordered collection | [1, 2, 3] |
| Tuple | Immutable ordered collection | (1, 2, 3) |
| Dictionary (dict) | Key-value pairs | {'name': 'John'} |
8. Outline the process of writing a comment in Python. (Applying) (CO1)
To write comments in Python, use the hash symbol (#) before the text. For single line comments, put # at the beginning of the line or after a statement. For multiple line comments, use triple quotes (""" """) at the beginning and end. Comments are ignored by the Python interpreter and are used to explain the code for better understanding.
9. Demonstrate how to use the print() function in Python script mode. (Applying) (CO1)
# Save this in a file with .py extension
print("Hello World")
print("My name is John")
print(2 + 3)In script mode, write the print statements in a text file and save it with .py extension. Run the file using Python interpreter. The print() function displays output on the screen and can print text, numbers, or variables.
10. Summarize the advantages of using algorithms in problem-solving. (Understanding) (CO1)
Algorithms provide a clear step-by-step approach to solve problems systematically. They help break down complex problems into simpler parts, making them easier to understand and solve. Algorithms ensure that the solution is logical and can be tested before writing actual code. They also help in communicating the solution to others and can be reused for similar problems, saving time and effort.