0% found this document useful (0 votes)
44 views76 pages

Computer Science

The document provides a comprehensive overview of computer science topics, including basic components of a computer, Python programming, algorithms, and problem-solving techniques. It covers essential concepts such as data vs. information, the functions of operating systems, and various programming constructs in Python. Additionally, it includes exercises and examples related to flowcharts, algorithms, and coding practices for students in Class 11.

Uploaded by

Prachi Molpariya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views76 pages

Computer Science

The document provides a comprehensive overview of computer science topics, including basic components of a computer, Python programming, algorithms, and problem-solving techniques. It covers essential concepts such as data vs. information, the functions of operating systems, and various programming constructs in Python. Additionally, it includes exercises and examples related to flowcharts, algorithms, and coding practices for students in Class 11.

Uploaded by

Prachi Molpariya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

Computer Science

All you need

Prachi 9/14/24 Class 11


COMPUTER Science
1.​ All About Computer
●​ Basic components of a computer system
●​ Memory
●​ Software
●​ Number system
●​ Encoding of characters
●​ Boolean Logic
●​ Truth Table
●​ Laws
●​ Problem Solving
●​ Algorithm
●​ Pseudocode
●​ Decomposition
2.​ Python Basics
●​ Python Programming Language
●​ Script mode and Interactive Mode
●​ Tokens
●​ Variables and Datatypes
●​ Type Conversions
●​ Operators
●​ Indentation
●​ Comments
●​ Debugging – Errors

3.​ Python Functions & Loops


●​ Print function
●​ Input Function
●​ User Defined Functions
●​ If – elif – else statements
●​ For loop
●​ While loop
●​ Nested loops
●​ Jump statements – break , continue and pass
4.​ Python Modules
●​ Modules in python
●​ Importing Python Modules
●​ Module Alliasing
●​ Member Alliasing
●​ Locating Modules
●​ Standard Built in Python Modules ( Functions )
5.​ Strings in Python
●​
6.​ Lists in Python
●​
7.​ Tuples and Dictionary
●​
8.​ Society , Laws and Ethics
●​
CH:01 All about Computer

system

1.​What is a computer?

2.​Define the IPO cycle.

3.​ Differentiate between data and information.


Ans. Data is any sequence of one or more
symbols. In other words, raw facts and figures constitute
data. Whereas, Data when processed or interpreted is
known as Information.

4.​Explain the Von Neumann Computer.

5.​What is Encoding?
A. Encoding is a system that maps characters,
symbols, or textual elements to numeric values or bit
patterns for digital representation and storage. It is
used to represent human-readable text and symbols as
binary data, which can be processed, transmitted, and
stored in computers and other digital systems.

6.​What are the functions of the control unit?


7.​ ‘Hardware is of no use without software and
software cannot be used without hardware.’ Explain.
8.​Differentiate between Program and Process.
A Program is a set of instructions stored in the
memory whereas a process is a program under
execution.

9.​ How can the software be classified? Name at least


one software in each of the categories.

10.​ Convert
●​32 MB into Bytes.
●​512 GB into TB.
●​256 TB into KB.

11.​ What are Registers?


A.​Registers are local or temporary storage
for the CPU. They are present on the
CPU itself and can be accessed quickly.

12.​ Explain the major functions of an operating system.

13.​ What is an operating system? Write names of any


two popular operating systems.

14.​ How is software classified?


●​System Software - The software that provides basic
functionality to operate a computer system through
its hardware is called System Software. It is further
classified into Operating System, Device Drivers,
Utilities.
●​2. Application Software - The software that is
developed as per end user requirements to run a
particular application is called Application Software.
It is further classified into General Purpose and
Customized Software.
●​3. Language Translators - The software that translates
programs in one language to another language is
called translator. Types of translators are - Assembler,
Compiler and Interpreter.
●​4. Programming Tools - Softwares used for typing,
editing, building, compiling and debugging programs
are called Programming Tools.

15.​ What is the purpose of a language processor?

16.​ What is the purpose of the system bus?


A. The system bus provides a path facilitating the flow of
data between the central processing unit (CPU), memory,
and various peripheral devices. The system bus is
typically divided into three main types of buses, Address
Bus, Control Bus and the Data Bus.
17.​ Differentiate between:

A.​ An interpreter and a compiler.


A. Both Compiler and Interpreter are language translators
that convert High Level Programming Language into Low
Level Language. A compiler converts the source code into
Low Level Language all at once, whereas an interpreter
translates the source code line by line. Example of
Compiler: GCC Compiler Example of Interpreter: Python
Interpreter

B.​ Hardware and Software


●​The devices that are tangible in nature (can be
touched) are called Hardware Devices, whereas
Software being digital cannot be touched.
●​Hardware is a physical component of a computer,
whereas Software is a set of instructions to a
computer to perform a specific task.
●​Hardware includes Input and Output Devices,
Storage Devices, Internal tangible Components of a
Computer. Software includes Programming Software,
Application Software, Operating system etc.

C.​ ASCII and ISCII.

D.​ Volatile and Non Volatille

E.​ ROM and RAM

F.​HDD and SSD


A.​HDD stands for Hard Disk Drive. It is a mechanical
non-volatile secondary storage device. SSD stands
for Solid State Drive, which is a non-volatile
memory that stores data without moving parts. SSDs
are faster, more durable, more compact, quieter, and
consume less energy.

G.​ Operating System and Device Driver


A device driver facilitates the interaction between the OS
and the hardware devices. Whereas, the OS is responsible
for the interaction between the user and the hardware.

18.​ What is Unicode? How is it useful?

19.​ What is
Primary memory?
Cache memory?
Secondary memory?

20.​ What is the full form of BIOS? OCR? MICR?

●​OCR stands for Optical Character Recognition. It is a


pattern recognition technology that identifies the text
present in digital form, such as an image, document
etc.
●​MICR stands for Magnetic Ink Character Reader. It is
a device that reads a special kind of ink which is
sensitive to magnetic fields. It is often used to verify
the originality of cheques and other documents.
●​Basic Input Output System.

21.​ What does ISCII stand for?


ISCII stands for Indian Script Code for Information
Interchange.

22.​ What is an os ? Explain its functions .

23.​ What are some of the applications of the


Hexadecimal Number System?
A.​Hexadecimal numbers are commonly used in
various applications due to their compact
representation and ease of conversion to and from
binary. They are also used to represent addresses in
memory, to represent colors on web pages, to
display error messages etc.

24.​ Explain the types of system software.


The System Software is further classified as -
Operating Systems, System Utilities and Device
Drivers.
A.​Operating Systems - It manages and controls
various resources of the computer system and
provides an user-friendly environment to interact
with the hardware of the computer. System
B.​Utilities - These are the programs used for
maintenance and configuration of the computer
system. These are used to monitor system
performance, manage files and storage, diagnosing
issues, and maintaining system security. 38
C.​Device Drivers - It is an interface between a
particular device and the operating system. It
ensures proper functioning of the device, overall
management of a particular device.

25.​ Give 2 examples of Mobile OS and Desktop OS


each.
26.​ How will you identify the type of a variable in a
Python program? Explain with an example.

27.​ What is the id of an object in Python? How can you


identify the id of an object explain with an example

28.​ “If the IDs of two objects are same than they must
have same value, but if any two objects have same
value they may not have same ID”. Explain with an
example.
29.​
30.​

31.​

32.​

33.​ What do you mean by type casting? Explain with


example.

34.​
35.​ What functions are available in Python for type
casting? Explain.

36.​ What functions are available in Python for type


casting? Explain.

37.​ Why is Boolean considered a subtype of integer?

38.​
39.​

40.​

41.​ What are the components of the CPU? How does


ALU work?
ALU is responsible for performing arithmetic operations
(addition, subtraction, multiplication, and division) and
logical operations (AND, OR, NOT) on binary data.
ALUs are designed to work with binary numbers, where
each bit represents a value of either 0 or 1.
42.​ Do as directed :
Ψ Convert the Decimal number 781 to its
Binary equivalent.
Ψ Convert Binary number 101101.001 to its
decimal equivalent
Ψ Convert Octal number 321.7 into its Binary
equivalent
Ψ Convert the Hexadecimal number 3BC into
its Binary equivalent
Ψ Convert the Binary number
10011010.010101 to its Hexadecimal
equivalent
Ψ Convert the Decimal number 345 into
Octal number.
Ψ Convert the Decimal number 736 into
Hexadecimal number.
Ψ Convert the Octal number 246.45 into
Hexadecimal number.
Ψ Convert the Hexadecimal number ABF.C
into Octal number.
Ψ Convert the Octal number 576 to Decimal.
Ψ Convert the Hexadecimal number A5C1 to
Decimal.

43.​ Name the two types of Primary Memory.

44.​ Write a few advantages of computers.


A. Few of the advantages of computers are
as follows,
● Multi-tasking
● Speed
● Productivity
● Accuracy
● Connectivity
● Education
● Storage
● Reliability

45.​ How does CU work?

CU is responsible for controlling and coordinating the


operations of the entire CPU and the overall execution of
instructions. The primary function of the Control Unit is
to fetch, decode, and execute instructions stored in
memory.

46.​ What is the purpose of registers in the CPU?

Set of Registers serve as fast, high-speed storage units


directly accessible by the CPU. They are used for
temporary storage of data and instructions during the
execution of programs. Registers provide several benefits
such as storage of intermediate

.
47.​ Write 2 examples of High Level Programming
Languages and low level programming language .
A.​ Python and C++.
B.​ Binary Language and Assembly
Language.

48.​ What is the purpose of System Clock?

49.​ Which input device is most suitable for the OS with


the following user-interface (UI)?
1. Graphical UI
2. Command Line UI
3. Gesture Based Interface
4. Voice Based Interface
5. Touch Based Interface
ANS. 1. Mouse 2. Keyboard 3. Camera/Webcam 4.
Microphone 5. Touch-screen

50.​ Why is an Operating system called a Resource


Manager?

A. The OS is responsible for managing various hardware


and software resources in a computer system, therefore it
can be called a resource manager. It performs the
following functions, Memory management, CPU
Scheduling, Device management, Storage management,
Network Management etc.
Why do we use secondary storage? Name any two
secondary storage devices.

51.​ What are input devices? List 5 input devices.


52.​ What are output devices? List 5 output devices.

53.​ Why is it more appropriate to call RAM as


Read-Write memory?

54.​ What is the purpose of Cache memory?

55.​ Distinguish between the following pairs: Primary


memory and Secondary memory RAM and ROM

56.​ Explain different types of OS User Interface.

57.​ How are high level languages converted into low


level languages?

58.​ Write down some advantages of computers.

59.​ Explain flowcharts with its major symbols.

60.​ Explain Pseudocode with example.

61.​ Explain Decision Trees with example.


62.​ Draw a flowchart to find the simple interest.

63.​ Draw a flowchart to find bigger number among two


numbers
64.​ Draw a flow chart to find factorial of any number.
65.​ Draw a flow-chart to identify whether a number
taken as the input from the user is an even number or
an odd number?

66.​ Draw a flow chart to find biggest number among


„n‟ numbers.
67.​ Draw a flow chart to print the number from 1 to ∞
68.​ Define Algorithm and Flowchart.
a.​

Logically algorithm, flowchart and program are the same.


69.​ Write an algorithm to find the sum of two numbers.

70.​ Write an algorithm to find the area of a triangle.


71.​ Create an algorithm to compute the volume of a
sphere. Use the formula: V = (4/3) *pi*r3 where pi is
equal to 3.1416 approximately. The r is the radius of
sphere. Display the result.

Ans.

72.​ Write an algorithm to find whether given number is


odd or even.

73.​ Write a program the converts the input Celsius


degree into its equivalent Fahrenheit degree. Use the
formula: F = (9/5) *C+32.
74.​ Write an algorithm to find the sum of all even
number up to given number.

75.​ Write a program that converts the input dollar to its


peso exchange rate equivalent. Assume that the
present exchange rate is 51.50 pesos against the
dollar. Then display the peso equivalent exchange
rate.
76.​ Draw a flowchart to find the area of a circle.

77.​ Write a program that converts an input inch(es) into


its equivalent centimeters. Take note that one inch is
equivalent to 2.54cms
78.​ Draw a flowchart to find the smallest number
among n numbers.

79.​ Write a program that exchanges the value of two


variables: x and y. The output must be: the value of
variable y will become the value of variable x, and
vice versa.
80.​ Draw a flowchart to find the sum of all multiples of
5 up to given number.

81.​ Design a program to find the circumference of a


circle. Use the formula: C=2πr, where π is
approximately equivalent 3.1416.
82.​ Write a program that takes as input the purchase
price of an item (P), its expected number of years of
service (Y) and its expected salvage value (S). Then
outputs the yearly depreciation for the item (D). Use
the formula: D = (P - S) Y.

83.​ Swapping of 2 variables without using temporary


(or 3rd variable)
84.​ Write an algorithm and a flowchart to find sum of n
numbers.
85.​ Determine the most economical quantity to be
stocked for each product that a manufacturing
company has in its inventory: This quantity, called
economic order quantity (EOQ) is calculated as
follows: EOQ=2rs/1 where: R= total yearly
production requirement S=set up cost per order
I=inventory carrying cost per unit.

Or
86.​ Write a program to compute the radius of a circle.
Derive your formula from the given equation: A=πr²,
then display the output.
CH:02 Python Basics

1.​

2.​What is an identifier?
3.​Differentiate between runtime errors and logical
errors.
4.​What is the purpose of giving meaningful name for
identifiers?
5.​What do you mean by debugging?
6.​What is indentation? Explain with an example.
7.​Explain all steps of problem solving process.
8.​Explain types of errors with examples.
9.​Differentiate between runtime errors and logical
errors.
10.​

11.​ Write the value justification


2*(3+4)
2*3+4
2+3*4
12.​ What is the type of the following result:
1+2.0+3

13.​ Which of the following is the valid variable


name: 1) global
2) 99flag sum
3) sum
4) an$wer

14.​ True or False


●​Character Data type values should be delimited by
using the single quote.
●​None is one of the data type in python
●​The += operator is used to add the right hand side
value to the left hand side variable.
●​The data type double is not a valid python data type
●​Python does not have any keywords
●​The equal to condition is written by using the ==
operator 122 6.
15.​ Check all syntactically correct statements
Which input statements are correct
a = raw_input ( )
a = raw_input (“enter a number”)
a = raw_imput (enter your name)
16.​

17.​
18.​

19.​

20.​
21.​

22.​

23.​
24.​
25.​
26.​
27.​
28.​

29.​
30.​ When will following statement in interpreter
result into error:
>>> B+4
31.​ How can we change the value of 6*1-2 to -6
from 4?
32.​ Name four of Python‟s Basic data types? Why
are they called so?
33.​ What are relational operators? Explain with the
help of examples.
34.​ How are keywords different from variable
names?
35.​ Why are data types important?
36.​ How can you convert a string to integer and
when can it be used?

37.​

38.​ Write a code to show the use of all 6 math


function.
39.​ Write a code that prints your full name and your
Birthday as separate strings.
40.​ Write a program that asks two people for their
names; stores the names in variables called name1
and name2; says hello to both of them.
41.​ Calculate root of the following equation:
a) 34x2 + 68x - 510
b) 2x 2 - x -3 = 0
42.​ Explain the concept of "type conversion" in
Python.
Type conversion refers to the process of changing
the data type of a value from one type to another. In
Python, this can be done explicitly or implicitly.
43.​ Explain the role of data types in Python.
Answer: Data types define the kind of data a
variable can hold. Examples of data types include
int, float, strings lists etc.
44.​ Explain operators in and not in with example.
ch:03 Python functions and

loops
1.​Explain the purpose of the break and continue
statements in Python.
2.​Explain if...else statement with syntax and
example.
3.​Explain while loop with syntax and example.

4.​ Explain if…elif statement with syntax and


example.

5.​What is range() function? Explain with syntax


and example.

6.​Differentiate counting and conditional loops.


Give the names of one conditional loop and
one counting loop available in Python.

7.​Explain with example one advantage of using


if…elif statement over using if statement
multiple times.
8.​Explain for loop with syntax and example.
9.​Explain break statement with syntax and
example.

10.​ Differentiate between for loop and while


loop .

11.​ Explain continue statement with syntax and


example.
12.​ Explain loop’s else statement used with
syntax and example.

13.​ What do you mean by named conditions or


stored conditions explain with example.

14.​ Write a program to find the value of


X!.(Factorial of X)

15.​

16.​
17.​ Write a program to arrange three numbers in
ascending order.

18.​

19.​
20.​

21.​ Write a program to find out the reverse of a


given number.

22.​ Write a program to find whether a number is


palindrome. (A palindrome is a number that is
same of its reverse)

23.​ Write a program to count the number of


digits in a given number.

24.​ Write a program to find the sum of all digits


of a given number.

25.​ Write a program to find the sum of all even


digits and odd digits separately.

26.​

27.​ Write a program to find the LCM of three


integers.
28.​ Write a program to convert lowercase
alphabet into uppercase and vice versa.

29.​ Write a program to find the HCF of three


integers.
30.​
31.​

32.​

33.​ Write a program to find out the value of Xy .


34.​ WAP to accept two integers and print their
sum.

35.​ WAP that accepts the radius of a circle and


print its area .

36.​ WAP that accepts base and height and


calculate the area of a triangle .

37.​ WAP that inputs a students marks in three


subjects ( out of 100 ) and prints the
percentage marks .

38.​ WAP to compute the area of square aaand


triangle .

39.​ WAP to calculate simple interest .

40.​ Write a program to calculate simple interest


using formula SI=P*R*T/100. Rate will be 5%
if the principal amount is less than 25000
otherwise rate will be 8 %.
41.​

42.​

43.​ WAP to read two numbers and prints their


quotient and remainder

44.​
45.​

46.​ WAP to find whether a given number is


even or odd .

47.​ WAP to find the largest among the three


integers .

48.​ WAP to find the lowest among the three


integers .
49.​ Write a program to calculate and print the
roots of quadratic equation ax2+bx+c=0. The
program should display suitable message
whether roots are real, equal, different or
imaginary.

50.​ WAP that accepts the length and breadth of


the rectangle and calculate its area .

51.​ WAP that accepts weight in kg and height in


m and calculate the BMI .

52.​ WAP that reads the number “n” and prints


the square and cube of n .

53.​ WAP to accept the marks of five subjects


and calculate the average marks .

54.​ Write a program to accept an integer and


display the corresponding day of week i.e. 1
for Monday, 2 for Tuesday and so on. If the
number is not in 1 to 7 it should display a
message “Invalid Day Number”.

55.​ WAP to accept height in cm and convert it


into feet and inches .
56.​ WAP that accepts the age and print if one is
eligible to vote or not .

57.​

58.​ WAP that accepts two numbers and check if


the first no. is fully divisible by second no. or
not.

59.​

60.​ WAP to read base, width and height of


parrelogram and calculate its area and
perimeter
61.​ WAP to accepts the year and check if it is a
leap year or not .

62.​ WAP to obtain x , y , z and calculate

4x^2 + 3y^3 + 9z – 6*pie .


63.​ WAP to input a number and print its square
if its odd , else print the square root .

64.​ WAP to input a number and check whether


it is positive , negative or zero .

65.​ WAP to input percentage marks of a


student and find grade as per the following
criterion .
66.​ WAP to enter a number and check if it is a
prime no. or not

67.​ WAP to display a menu for calculating the


area of the circle or perimeter of the circle.

68.​ WAP to print whether a given character is


an uppercase or lowercase character or a digit
or any other character .

69.​

70.​ WAP to print the sum of natural numbers


between 1 and 7 . Print the sum progressively
i.e after adding each natural no. , a print sum
so far .

71.​ WAP to calculate the factorial of a number .

72.​ WAP to print first 20 fibonacci elements .

73.​ WAP to calculate BMI and print the


nutritional status as per the following table. (
BMI = weight in Kgms./ (height in meter)^2)
74.​ WAP to read an integer>1000 and reverse
the number .

75.​ Input three angles and determine if they


form a triangle or not .

76.​ WAP that displays first ten Mersenne


numbers .

77.​ WAP that displays the first 10 mersenne


numbers and displas “Prime” next to
Mersenne prime numbers .

78.​ WAP to create a triangle of stars using a


nested loop .

79.​
80.​

81.​

82.​

83.​
84.​

85.​

86.​

87.​
88.​
89.​

90.​

91.​
92.​

93.​

94.​
95.​

96.​

97.​

98.​

99.​ Write a program to calculate the sum of two


numbers and print their sum.

100.​ Write a program that accepts the radius


of a circle and prints its area.

101.​ Write a program to compute simple


interest.
102.​ Write a program to take sides of a
triangle as input and print its area.

103.​ Write a program to find whether a given


number is even or odd?

104.​ Write a program to find the factorial of a


number.

105.​ Write a program to display the Fibonacci


sequence up to n-th term where n is provided
by the user

106.​ Write a program in Python to check if a


number entered by a user is a prime number
or not.

107.​ Write a Program to check if the input


year is a leap year or not

108.​ Consider the code given below: x=5


print(x==5)
A: Output of above python code is True.
R: '==' is logical Operator.
A. Only A is True.
B. Only R is True.
C. Both A and R are True, but R is not the
correct reason for A.
D. Both A and R are True, but R is the correct
reasoning for A. Answer : A. Only A is true.

109.​ Example
110.​ Write a script that asks a user for a
number. Then adds 3 to that number, and then
multiplies the result by 2, subtracts twice the
original number, then prints the result.
111.​In analogy to the example, write a script that
asks users for the temperature in F and prints
the temperature in C.
(Conversion: Celsius = (F - 32) * 5/9).
112.​ Write a Python function, odd, that takes
in one number and returns True when the
number is odd and False otherwise. You
should use the % (mod) operator, not if.
113.​ Define a function „SubtractNumber(x,y)‟
which takes in two numbers and returns the
difference of the two

114.​ Write a Python function, fourthPower( ),


that takes in one number and returns that
value raised to the fourth power.
115.​ Write a program that takes a number
and calculate and display the log, square, sin
and cosine of it

116.​ a) Write a program, to display a


tic-tac-toe board on screen, using print
statement.
b) Write a program to display a tic-tac-toe
board on screen using variables, so that you
do not need to write many print statements?

117.​ Write a function roll_D ( ), that takes 2


parameters- the no. of sides (with default
value 6) of a dice, and the number of dice to
roll-and generate random roll values for each
dice rolled. Print out each roll and then return
one string “That‟s all

118.​ Write a Python Program to print first n


Natural numbers and their sum.
119.​ Write a Python program to print table of
a given number.

120.​ Write a Python program to perform


arithmetic calculation. This program accepts
two operands and an operator then displays
the calculated result.

121.​ Write a Python program to check


whether a given number is equal to the sum of
the cubes of its digits.

122.​ Write a Python Program to accept two


integers X and N, compute XN

123.​ Write a program to print following


pattern on screen.

124.​ Program to add the odd numbers up to


(and including) a given value N and print the
result.
125.​ Compute the greatest common divisor
and the least common multiple of two integers.

126.​ Write a Python program to generate


prime numbers for given range.

127.​ Write a Python Program to check


whether the given number is palindrome or
not.

128.​ Write a Python program to sort a list of


10 numbers using Bubble Sort method.

129.​ Write a Python program to sort a list of


10 numbers using Insertion Sort method.

130.​ SQL Commands (At least 15 SQL


queries related to create, insert, delete, select,
group by, order by, aggregate functions , like ,
where, in, between, Alter , update)

131.​ To check whether the number is perfect


number or not
132.​ To print a pattern using nested loops

133.​
134.​
135.​
136.​
137.​
138.​
139.​
140.​
141.​
142.​
143.​
Write a Python program to count the number
of strings of length 2 or more and the first and
last character are same from a given list of
strings

You might also like