0% found this document useful (0 votes)
6 views27 pages

SCL Python

The document consists of a series of worksheets designed for Python programming exercises, covering topics such as prime numbers, looping statements, Armstrong numbers, recursion, and sorting algorithms. Each worksheet includes questions and prompts for students to answer, along with sections for inference and assessment. The worksheets aim to reinforce Python concepts and provide practical coding experience.

Uploaded by

s.ramkumar88759
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)
6 views27 pages

SCL Python

The document consists of a series of worksheets designed for Python programming exercises, covering topics such as prime numbers, looping statements, Armstrong numbers, recursion, and sorting algorithms. Each worksheet includes questions and prompts for students to answer, along with sections for inference and assessment. The worksheets aim to reinforce Python concepts and provide practical coding experience.

Uploaded by

s.ramkumar88759
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/ 27

PART – B SCL WORKSHEET

WRITE A PYTHON PROGRAM TO PRINT PRIME NUMBERS IN THE GIVEN RANGE

Worksheet No : 1 Date :

1. What is Python?

Ans:

2. When and by whom was Python created?

Ans:

3. What are the advantages of python?

Ans:

4. Python is a open source language?

Ans: b) False
a) True

5. Python is a case sensitive language.

Ans: b) False
a) True

6. Python is a compiled language.

Ans: b) False
a) True

7. Python is a cross platform language.


Ans: b) False
a) True

8. Find the invalid identifier from the following?


Ans: a) Myname b) Yourname c) True d) $pricein
9. Which of the following is used to define a block of code in Python language?

Ans: a)Indentation b)Key c) Brackets d) All of the


mentioned
10. What are the key features of python?

Ans:

11. What type of language is python? Programming or scripting?

Ans:

12. Which of the following is the correct extension of python?

Ans: a) .py b) .pl c) .p d) None of the


above
13. In python, ‘accept’ is exception handling keyword?
Ans:

14. Write the syntax to print message in python.


Ans:

15. What is a prime number?


Ans:
PART –C INFERENCE
WRITE A PYTHON PROGRAM TO PRINT PRIME NUMBERS IN THE GIVEN RANGE

INFERENCE
1. What have you inferred from this experiment?

Ans:

APPLICATIONS
2. Write down any inbuilt functions used in python and also mention its use.

Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
IMPLEMENT VARIOUS LOOPING STATEMENTS IN PYTHON
Worksheet No : 2 Date :

1. What is meant by programming?


Ans:

2. What are if else statements?


Ans:

3. Which is the smallest Armstrong number?


Ans:

4. Is python a high level language?


Ans: a) Yes b) No

5. What is an identifier with example?

Ans:

6. Is 2006 a leap year?

Ans:

7. True is type of variable.


Ans: a) string b) boolean

8. What are the two main types of functions in python?


Ans:

9. Mention any 2 options of wc command and mention its purpose


Ans:
10. Expand OOPS?
Ans:

11. What is the function of while loop?


Ans:

12. Which one of the following is not a key word in python language?

Ans: a) pass b) eval c) assert d) nonlocal

13. What’s the newest version of python software?


Ans:

14. Which one of these is floor division?


Ans: a) / b) // c) % d) None of the
mentioned

15. What is the output of this expression, 3*1**3?


Ans:
PART – C INFERENCE
IMPLEMENT VARIOUS LOOPING STATEMENTS IN PYTHON

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. Write the basic concept to find out whether the given year is leap year or not?

Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
WRITE A PYTHON PROGRAM TO PRINT ARMSTRONG NUMBERS BETWEEN GIVEN RANGE
Worksheet No : 3 Date :

1. What is Armstrong number?


Ans:

2. How machine language differs from assembly language?


Ans:

3. Why python is called high level language?


Ans:

4. ROM stands for _______________


Ans:

5. Discuss about Characteristics of python


Ans:

6. Write about Operators in python

Ans:

7. Compare RAM and ROM


Ans:

8. Why python called as OOPs Programming?


Ans:
9. Define class.
Ans:

10. Define methods.

Ans:

11. What is meant by object? Give example.


Ans:

12. What is data encapsulation?


Ans:

13. What is inheritance?


Ans:

14. List out the types of inheritance.

Ans:

15. Compare Local and global variable.


Ans:
PART – C INFERENCE
WRITE A PYTHON PROGRAM TO PRINT ARMSTRONG NUMBERS BETWEEN GIVEN RANGE

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. Write the industrial uses of the program.
Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
WRITE A PYTHON PROGRAM TO FIND MINIMUM AND MAXIMUM OF A GIVEN RANGE OF
NUMBERS
Worksheet No : 4 Date :

1. How to slice a string?

Ans:

2. What is the order of precedence in python?

Ans:

3. In which year was the Python language developed?

Ans: a) 1995 b) 1972 c) 1981 d) 1989

4. In python code, on encountering a syntax error, the _________________ does not execute
the program.
Ans: a) b) Editor c) Interpreter d) Converter
Processor
5. What is the full form of CSV file in python?

Ans:

6. Which keyword is used for function in Python language?

Ans:

7. Which arithmetic operations have the same precedence?


Ans:
8. In which year was the Python 3.0 version developed?

Ans: a) 2008 b) 2010 c) 2000 d) 2005

9. What do we use to define a block of code in Python language?

Ans: a) Key b) Brackets c) Indentation d) None of these

10. Which character is used in Python to make a single line comment?

Ans: a) / b) // c) # d) !

11. What is the method inside the class in python language?

Ans: a) Object b) Function c) Attribute d) Argument

12. What is the state of the processor, when a process is waiting for some event to occur?

Ans:

13. What does PIP stand for python?

Ans:

14. What is the full form of PSW?

Ans:

15. What will be the output of the following Python code?


i=1
while True:
if i%3 == 0:
break
print(i)
i+=1

Ans:
PART – C INFERENCE
WRITE A PYTHON PROGRAM TO FIND MINIMUM AND MAXIMUM OF A GIVEN RANGE OF
NUMBERS

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. List out the conditions used in slicing and finding number of characters in a string.
Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
IMPLEMENT RECURSION USING PYTHON
Worksheet No : 5 Date :

1. What is Fibonacci number?

Ans:

2. What is the syntax of for loop in python?

Ans:

3. The _________________operator returns the quotient after division.

Ans:

4. What is recursion means?

Ans:

5. What is the condition used in while statement?

Ans:

6. Python refers to everything as an ________________ including numbers and strings.

Ans:

7. Find the error.


a = 10
b = 20
sum = a + b + c
print(sum)
Ans:

8. Variable names can contain only?

Ans: a) letters b) numbers c) underscore d) all of the above


9. Whick keyword is used to remove the variable?

Ans:

10. To specify more than one statements in a single line, use a ______ to separate the statements.

Ans: a), b) ; c) : d) /

11. Which operator treats operand as a sequence of bits?

Ans: a) Relational b) Arithmetic c) Bitwise d) Logical

12. Which of the following is placed after the if condition?

Ans: a) ; b) . c) : d) ,

13. Which statement ends the current iteration of the loop and continues with the next one?

Ans: a) break b) continue c) skip d) pass

14. The _________________operator returns the quotient after division.

Ans: a) / b) // c) % d) none of the above

15. How many lines will be printed by this code?


While False:
Print(“ Hello”)
Ans: a) 1 b) 0 c) 10 d) countless
PART – C INFERENCE
IMPLEMENT RECURSION USING PYTHON

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. Explain the terms i) LILO ii) Swap space
Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
WRITE A PYTHON PROGRAM TO CHECK THE GIVEN YEAR IS LEAP YEAR OR NOT
Worksheet No : 6 Date :

1. The tiny individual unit in python program is known as ___________

Ans: a ) expression b)statement c) token d) comment

2. shape() function in Numpy array is used to?


Ans:

3. Identify the right way to close a file?


Ans:
a) File.close() b) close(File) b) close(“File”) d) File.closed

4. RAM is an example of non volatile memory?

Ans: a)True b)False


5. The difficult access mode is?
Ans:
a) r b) w b) rb d) wb

6. By default, a new file is created in which directory?

Ans: a) root b) current working b) python


d) D drive
directory directory directory
7. What command is used to count the total number of lines, words, and characters
contained in a file?
Ans: A) countw B) wcount C) wc D) count p

8. Python strings are immutable.

Ans: a) TRUE b) FALSE

9. Find the output.


Str = “Welcome to python””
For i in str:
Print (i, end=’ ‘)
Ans:
10. Which error is generated when the index is not integer?
A) Index error B) Name error C) Type error D) Bound error
Ans:

11. If(2+_________)**2=25
Ans:

12. You can delete the entire string using which keyword.
Ans:

13. ________operators acts on single operands

Ans:

14. What is an operand?

Ans:

15. Compare unary and binary operators?

Ans:
PART – C INFERENCE
WRITE A PYTHON PROGRAM TO CHECK THE GIVEN YEAR IS LEAP YEAR OR NOT

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. Write the program to string compare.

Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
WRITE A PYTHON PROGRAM TO SORT A SET OF ELEMENTS USING SELECTION SORT.
Worksheet No : 7 Date :

1. Define selection sort?

Ans:

2. How does selection sort works?

Ans:

3. Define bubble sort.

Ans: a)1 b)5 c)2 d)0

4. type(x) will print?

Ans: < class ‘list’ > < class ‘tuple’ > < class ‘int’ >

5. Define insertion sort.

Ans:

6. How does insertion sort works?

Ans:

7. The input() function take user’s input as a

Ans: integer string float long


8.
a =7
if a>4: print("Greater") WHAT IS THE OUTPUT?

Ans: a) Greater b) c) 4 d)No


7 ne of
the
abov
e
9. Importance of sorting algorithm in python?

Ans:

10. Disadvantages of selection sort.

Ans:

11. Python dictionary is used to store data in a which format?

Ans:

12. Conditional statements are also known as _______________ statements.


Ans:

13. Amongst which of the following shows the types of function calls in Python?
Ans:
a) call by value b) call by reference c) both a & b d) none of the
above
14. Can we pass List as an argument in python?

Ans:
15. The return value for trunc() would be?
Ans:
a) bool b) float c) int d) none
PART – C INFERENCE
WRITE A PYTHON PROGRAM TO SORT A SET OF ELEMENTS USING SELECTION SORT

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. Explain in detail about sorting and sorting algorithms.

Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
WRITE A PYTHON PROGRAM TO MULTIPLY TWO MATRICES
Worksheet No : 8 Date :

1. What are the two main type of functions in python?

Ans:

2. Which statements are used to repeatedly execute one or more statements in a block?

Ans:

3. What will be the output of the following python expression?


round(4.576)
Ans: a) 4 b) 4.6 c) 5 d) 4.5

4. Python assumes any non-zero and non-null values as

Ans: a) True b) False c) zero

5. What is a matrix number?

Ans:

6. What is concatenation?
Ans:

7. Which loop is called a definite loop?

Ans: a) if b) while c) for d) do-while


8. Does python involves in memory allocation?

Ans: a) Yes b) No

9. What is the use of len() function?

Ans:
10. PVM is also called as?

Ans:

11. ___________________ begins with a keyword and end with a colon.

Ans:

12. List some of the comparison operators?


Ans:

13. Which part of if loop should be indented?


Ans:
a) The first b) All the c) within the if block d) none of these
statement statements
14. Which statement indicates a NOP?

Ans:
15. Define recursive functions.
Ans:
PART – C INFERENCE
WRITE A PYTHON PROGRAM TO MULTIPLY TWO MATRICES

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. Write a program logic to add the two matrices?

Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date
PART – B SCL WORKSHEET
WRITE A PYTHON PROGRAM TO PERFORM STRING TRAVERSE
Worksheet No : 9 Date :

1. How to find the length of the string?

Ans:

2. How to print string reverse without function?

Ans:

3. What is meant by Armstrong number?

Ans:

4. Define polymorphism

Ans:

5. Discuss bitwise operators.

Ans:

6. Compare bitwise operators XOR and AND in python

Ans:

7. Abbreviation for RAM

Ans:

8. Write about range () function

Ans:
9. Write about condition and counter controlled loop.

Ans:

10. Write about function.

Ans:

11. Define function call

Ans:

12. How variables are accessed in a function?

Ans:

13. Write about scope of a variable?

Ans:

14. Why return statement is needed in function?

Ans:

15. Real time systems are -----------

Ans: a) primarily used b) used for c) used for d) used for real-
on mainframe monitoring events program analysis time interactive
computers as they occur
PART – C INFERENCE
WRITE A PYTHON PROGRAM TO PERFORM STRING TRAVERSE

INFERENCE
1. What have you inferred from this experiment?

Ans:

EXERCISES
2. What do you mean by string traverse?
Ans:

ASSESSMENT
Name of the Student Name of the
facilitator
Register Number Comments:

Year / Semester Marks (5+3+2) /10

Signature of the Signature of the


student facilitator with
date

You might also like