9th CS Unit-1

You might also like

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

9th - Computer Science

Unit# 1 – Exercise

Q1. In a farm, there are some cows and birds. If there are total 35 heads
and 110 legs then how many cows and birds are there?

1. Understanding the Problem:

Total heads: C + B = 35

Total legs: 4C + 2B = 110

2. Solving the Equations:

Expressing B in terms of C: B = 35 – C

Substituting B into the second equation:

4C + 2(35 – C) = 110

4C + 70 – 2C = 110

4C -2C + 70 = 110

2C + 70 = 110

2C = 110 – 70

2C = 40No

C = 40/2 (40 is divided by 2)

C = 20

3. Finding Birds:

Substituting C into the equation to find B:

B = 35 – 20

B = 15

4. Answer:

So, there are 20 cows and 15 birds on the farm.

1
Q2. Define problem analysis. Explain your answer with an example.

Problem Analysis: Problem analysis means figuring out what's wrong and
why. It's about looking at a problem step by step to understand it better.
This includes identifying the problem, gathering information, researching
solutions, and analyzing what's causing the issue.

Example: Imagine your computer keeps crashing. First, you'd check when
it happens and what programs are open. Then, you'd look for any error
messages. After that, you'd search online to see if others have had similar
problems and how they fixed them. Finally, you'd think about why it's
happening, like if there's a problem with the software or something wrong
with the computer's parts.

Q3. Define an algorithm & argue on its rule & importance in problem
solving.

Algorithm Definition: An algorithm is like a recipe for solving a problem. It's


a set of steps or rules that show us what to do, just like a recipe guides us
in cooking.

Rule & Importance: The rule of an algorithm is to give clear and precise
instructions that anyone, including a computer or a person, can follow to
solve a problem efficiently. Algorithms are important in problem-solving
because they help us break down big problems into smaller, easier steps.
This makes it easier to solve the problem accurately every time.

Q4. Solving a problem has multiple algorithms. How would you choose the
most efficient one? Explain with examples.

Choosing the Most Efficient Algorithm: When we want to pick the best
way to solve a problem, we think about things like how fast it works, how
much memory it needs, and how easy it is to understand. We can do this
by comparing different methods and seeing which one is better in terms
of time and space.

Example: Let's say you have a bunch of numbers that need to be


organized. You could use different ways to put them in order, like Bubble
Sort, Merge Sort, or Quick Sort. You'd look at how long each method takes
2
to finish (time complexity) and how much memory it needs (space
complexity). Then, you can choose the one that works the fastest and uses
the least memory for your specific task.

Q5. How do you determine requirements for a flowchart?

Requirements for a Flowchart: When we make a flowchart, we need to


think about what steps we need to take to finish a task, when we need to
make decisions, and what order things should happen in.

Q6. Explain types of data.

Types of Data: There are different types of data in computer science,


including:
Integer: Whole numbers without decimals (5, -10)
Float: Numbers with decimals (3.14, -0.5)
String: Text or characters ( "Hello, world!")
Boolean: True or false values ( true, false)

Q7. Describe a trace table.

Trace Table Description: A trace table is a handy tool for programmers. It


helps them keep track of how values change as a program runs. By seeing
how data changes step by step, programmers can spot any mistakes and
understand how the program works better. This makes it debug or fix
errors and analyze why the program behaves a certain way.

You might also like