Untitled document (4) (1)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

1. Define an algorithm.

Answer: An algorithm is a step-by-step procedure or set of rules to solve a specific problem or


perform a task.

2. Write any two characteristics of a good algorithm.


Answer:

Finiteness: An algorithm must terminate after a finite number of steps.

Definiteness: Each step of the algorithm must be clear and unambiguous.

3. What is the purpose of a flowchart?


Answer: A flowchart is used to visually represent the steps of an algorithm, making it easier to
understand and communicate the process.

4. List two symbols used in flowcharts and their meanings.


Answer:

Oval: Represents start or end.

Diamond: Represents decision-making.

3-Mark Questions

5. Differentiate between an algorithm and a flowchart.


Answer:
| Feature | Algorithm | Flowchart |
|------------------|----------------------------------------|--------------------------------------|
| Definition | A step-by-step procedure to solve a problem. | A graphical representation of an
algorithm. |
| Representation | Written in text. | Represented using symbols. |
| Complexity | Can be complex to understand. | Easier to interpret visually. |

6. Draw a flowchart to check if a number is even or odd.


Answer:
Start

Input number

Decision: Is the number divisible by 2?

If YES: Print "Even"

If NO: Print "Odd"

End

---

Part 2: Introduction to Python

2-Mark Questions

1. What is Python?
Answer: Python is a high-level, interpreted programming language known for its simplicity and
readability.

2. Mention two applications of Python.


Answer:

Web development (e.g., using Django or Flask).

Data analysis and visualization (e.g., using Pandas or Matplotlib).

3. What is the purpose of Python IDLE?


Answer: Python IDLE (Integrated Development and Learning Environment) provides a platform
to write, edit, and run Python programs.

4. What are variables in Python?


Answer: Variables are containers for storing data values in Python. They allow you to label and
manipulate data in your programs.

3-Mark Questions

5. Write the steps to install Python on your computer.


Answer:

Download Python from the official website (https://www.python.org).

Run the installer and follow the installation prompts.

Ensure the "Add Python to PATH" option is checked during installation.

6. Explain the difference between Interactive Mode and Script Mode in Python.
Answer:

Interactive Mode: Allows users to test and execute code line by line in the Python shell.

Script Mode: Allows users to write, save, and execute complete Python programs as scripts.

7. What is the difference between implicit and explicit type conversion?


Answer:

Implicit Conversion: Python automatically converts one data type to another (e.g., int to float).

Explicit Conversion: The programmer explicitly converts a data type using functions like int(),
float(), or str().

[18:46, 11/30/2024] Keshav !$@*": 1. What is an algorithm?


a) A step-by-step solution to a problem
b) A programming language
c) A computer hardware component
d) None of the above
Answer: a
2. Why are algorithms important?
a) They help to solve problems logically
b) They make the computer run faster
c) They reduce the need for programming
d) None of the above
Answer: a

3. Which of these is NOT a characteristic of an algorithm?


a) Finiteness
b) Ambiguity
c) Input and output
d) Effectiveness
Answer: b

2. Basics of Flowchart

4. What is a flowchart?
a) A diagrammatic representation of an algorithm
b) A programming language
c) A type of database
d) None of the above
Answer: a

5. Which symbol represents a decision in a flowchart?


a) Oval
b) Rectangle
c) Diamond
d) Circle
Answer: c

6. Which of the following is used to represent the start or end of a flowchart?


a) Oval
b) Diamond
c) Rectangle
d) Parallelogram
Answer: a
3. Additional Questions

7. What does the rectangle symbol in a flowchart represent?


a) Decision
b) Process
c) Input/Output
d) Start/End
Answer: b

8. A good algorithm must have:


a) Infinite steps
b) A clear stopping point
c) Multiple outputs
d) None of the above
Answer: b

Part 2: Introduction to Python

1. Basics of Python

1. What is Python?
a) A type of snake
b) A high-level programming language
c) An operating system
d) None of the above
Answer: b

2. Why is Python popular for AI?


a) It is fast
b) It has many libraries and frameworks for AI
c) It is the oldest programming language
d) None of the above
Answer: b

3. Which of the following is NOT an application of Python?


a) Web development
b) Game development
c) Rocket launching
d) Data analysis
Answer: c

2. Getting Started with Python

4. What is Python IDLE?


a) A hardware device
b) An Integrated Development and Learning Environment
c) A cloud-based software
d) A type of compiler
Answer: b

5. Which mode in Python is used for quick testing of code?


a) Script Mode
b) Interactive Mode
c) Batch Mode
d) None of the above
Answer: b

6. What command is used to display output in Python?


a) input()
b) print()
c) display()
d) output()
Answer: b

3. Variables and Operators

7. Which of the following is a valid variable name in Python?


a) 1_variable
b) variable1
c) variable-1
d) None of the above
Answer: b

8. Which operator is used for addition in Python?


a) -
b) *
c) +
d) /
Answer: c

4. Additional Questions

9. What is the purpose of comments in Python?


a) To execute the program faster
b) To describe the code for readability
c) To test syntax
d) None of the above
Answer: b

10. Which keyword is used to define a function in Python?


a) define
b) def
c) function
d) fun
Answer: b

11. Python is:


a) Compiled
b) Interpreted
c) Both compiled and interpreted
d) None of the above
Answer: b

What is the output of an algorithm if the input is invalid?


a) The algorithm skips the input
b) The algorithm stops abruptly
c) The algorithm gives an error message
d) The algorithm does not work
Answer: c) The algorithm gives an error message

Q3: Which of the following techniques is NOT used in designing algorithms?


a) Recursion
b) Flowcharts
c) Iteration
d) Compilation
Answer: d) Compilation

Q4: What is the purpose of a "decision" step in an algorithm?


a) To perform a calculation
b) To stop the algorithm
c) To choose between alternative paths
d) To repeat a process
Answer: c) To choose between alternative paths

Q5: In an algorithm, a step like "Repeat until x = 0" is an example of:


a) Selection
b) Recursion
c) Iteration
d) Termination
Answer: c) Iteration

Flowcharts (MCQs)
Q6: In a flowchart, the oval shape is used for:
a) Input/Output
b) Process
c) Decision-making
d) Start/End
Answer: d) Start/End

Q7: In a flowchart, arrows are used to:


a) Indicate the sequence of steps
b) Show the type of operation
c) Highlight errors
d) Represent conditions
Answer: a) Indicate the sequence of steps

Q8: What type of process can be represented by a diamond symbol in a flowchart?


a) Decision-making
b) Data storage
c) Input/Output
d) Process execution
Answer: a) Decision-making

Q9: Which of the following flowchart symbols represents input or output?


a) Rectangle
b) Parallelogram
c) Diamond
d) Circle
Answer: b) Parallelogram

Q10: A flowchart is best described as:


a) A written description of an algorithm
b) A visual representation of a process
c) A programming language
d) A method for debugging
Answer: b) A visual representation of a process

Introduction to Python (MCQs)


Q11: Which of the following is a Python keyword?
a) for
b) var
c) define
d) function
Answer: a) for

Q12: What is the correct syntax to print a message in Python?


a) Print "Hello, World!"
b) print("Hello, World!")
c) PRINT "Hello, World!"
d) echo "Hello, World!"
Answer: b) print("Hello, World!")

Q13: Which data type is immutable in Python?


a) List
b) Dictionary
c) Tuple
d) Set
Answer: c) Tuple

Q14: What will the following code output?

python
Copy code
x=5
y=2
print(x ** y)
a) 25
b) 10
c) 7
d) 32
Answer: d) 32

Q15: What is the result of the following expression?

python
Copy code
10 // 3
a) 3
b) 3.33
c) 10
d) 1
Answer: a) 3

Q16: Which Python library is used for data analysis?


a) matplotlib
b) pandas
c) tkinter
d) os
Answer: b) pandas

Q17: How do you write comments in Python?


a) // This is a comment
b) /* This is a comment */
c) # This is a comment
d) <!-- This is a comment -->
Answer: c) # This is a comment

Q18: Which of the following is NOT a Python data type?


a) Integer
b) Float
c) Char
d) String
Answer: c) Char

Q19: Which function is used to find the length of a list in Python?


a) size()
b) count()
c) length()
d) len()
Answer: d) len()

Q20: What is the output of the following code?


python
Copy code
x = "Python"
print(x[0])
a) P
b) y
c) t
d) Python
Answer: a) P

You might also like