Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Python Paper

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Python Paper

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PACKETPREP ASSESSMENT

Topic :: PYTHON BASICS

Name:: Contact::

Email:: Date::_ _Time::60 Mins

(60 marks paper)

I.Answer the All MCQs 15*1=15 M

1. Who developed Python Programming Language?


a) Wick van Rossum
b) Rasmus Lerdorf
c) Guido van Rossum
d) Niene Stom

2. Is Python case sensitive when dealing with identifiers?


a) no
b) yes
c) machine dependent
d) none of the mentioned

3. Is Python code compiled or interpreted?


a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

4. All keywords in Python are in _________


a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

5. Which of the following character is used to give single-line comments in


Python?
a) //
b) #
c) !
d) /*

6. What is the order of precedence in python?


a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

7. Which of the following is not a core data type in Python programming?


a) Tuples
b) Lists
c) Class
d) Dictionary
8. What will be the output of the following Python function?

len(["hello",2, 4, 6])

a) Error
b) 6
c) 4
d) 3

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

x = 'abcd'
for i in x:
print(i.upper())

a) A B C D

b) A b c d

c) A

d) None of the above


10. What will be the output of the following Python code snippet?

for i in [1, 2, 3, 4][::-1]:


print(i, end=' ')
a) 4 3 2 1
b) error
c) 1 2 3 4
d) none of the mentioned

11. What will be the output of the following Python program?


z=set('abc')
z.add('san')
z.update(set(['p', 'q']))
print(z)
a) {‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’}
b) {‘abc’, ‘p’, ‘q’, ‘san’}
c) {‘a’, ‘b’, ‘c’, ‘p’, ‘q’, ‘san’}
d) {‘a’, ‘b’, ‘c’, [‘p’, ‘q’], ‘san}

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

print("abc. DEF".capitalize())
a) Abc. def
b) abc. def
c) Abc. Def
d) ABC. DEF

13. Which of the following statements is used to create an empty set in Python?
a) ( )
b) [ ]
c) { }
d) set()

14. To add a new element to a list we use which Python command?


a) list1.addEnd(5)
b) list1.addLast(5)
c) list1.append(5)
d) list1.add(5)

15. What is the maximum possible length of an identifier in Python?


a) 79 characters
b) 31 characters
c) 63 characters
d) none of the mentioned

I.Answer All The Programs. (9*5=45)

1.Write a program to print given number is prime or not ?

Input: 11

Output:Prime Number
Input1:14 ; Output:Not a prime number

2.Write a program to find the factorial of number?

Input: 5

Output: 120

3.write a program to display number table by using the for loop

Input: 5

Output:5*1=5

5*2=10

Upto 5*10=50.

4.Write a program to print the prime number between the range 1


to 100.

5.Write a program to print even number between the range 1 to 100.

6.Write a program to print given string is palindrome or not?

Input:121

Output:Palindrome

Input1:132

Output: not a palindrome

7.Write a program swapping of two number

Input A=10

B=20
Output: A=20 B=10

8.Write a program to print the prime numbers from the list

Input: [1,3,5,10,14,18,19,21,23,29]

Output:[1,3,5,19,23,29]

9.Write a program to print the sum of first 10 Natural numbers.

You might also like