100 Important Python Fundamentals Practice Questions

Share with others

Python Fundamentals Practice Questions

Python Fundamentals practice questions

Table of Contents

Python  Fundamentals Practice Questions – Test 1

Q. Name two modes of Python.

Q2. Write Full Form of IDLE

Q3. Interface mode of python is also known as _______________.

Q4. In which mode we get result immediately after executing the command?

Q5. Write the output of the following.

a. >>> x = 5

   >>> y = 7

   >>> print(x + y )

b. >>> print(2 **5)

Q6. Write one drawback of interactive mode.

Q7. Ananya purchased 5 pencils and 2 erasers at the cost of Rs 7 and Rs 5 respectively. Write the program to calculate & display the total amount paid by ananya.

Q8. What do you mean by comments in Python?

Q9. Which symbols are used for single line comments and multiple line comments?

Q10. What do you mean by variable?

 

Python Fundamentals Practice Questions – Test 2

Q1. What is the purpose of creating variables?



Q2. Write code to find the address of variable.


Q3. What do you mean by data type?


Q4. Write three numeric data type in python.


Q5. Name three sequential data types in python.


Q7. Data type of variable is according to the value it holds.(T/F)


Q8. Which data type store the combination of real and imaginary numbers?


Q9. Write the output of the following:
>>> 4.7e7
>>> 3.9e2


Q10. Which data type return value True or False?

Python Fundamentals Practice Questions – Test 3

Q1. Write the output of the following :

  1. >>> (75 > 2 **5)
  2. >>> (25 != 5 *2)

Q2. Which operator can be changed in above part (2) so that it returns True?

Q3. Dictionary is enclosed in ___________ brackets.

Q4. What do you mean by keywords in python?

Q5. Keywords can be used as variable names (T/F)

Q6. Write the code to display all keywords in python.

Q7. Write two keywords which start with capital letters.

Q8. Write the output of the following

>>> str = "Informatics"
>>>str[3] = 'e'
>>> print(str)

Q9. Write the output of the following:

>>> a = [1,2,3]
>>>a[0] = 6
>>>print(a)

Q10. Name three types of operators in python.

Python Fundamentals Practice Questions – Test 4

Q 1. What do you mean by Escape sequence?



Q 2. Write the output of the following
        >>> x = 2 + 5j
        >>> print(x.real, x.imag)



Q 3. What is None data type?



Q 4. Write the output of the following
    
    >>> v1 = 10
    
    >>> v2 = None
    
    >>> v1
    
    >>> v2
    
    >>>print(v2)



Q 5. What is the purpose of type() function?



Q 6. Write the output of the following.
    
    >>> type(10)
    
    >>>type('10')
    
    >>>type(10.0)
    
    >>>type(True)
    
    >>>type('False')



Q 7. Which function is used to find the data type of variable?



Q 8. Write the output of the following
    
    >>> a = "hello"
    
    >>> b = 10
    
    >>> c = 9.8
    
    >>> d = 7 + 3.6j
    
    >>> print(a)
    
    >>> print(b)
    
    >>> print(c)
    
    >>> print(d)



Q9. Identify the variable name, variable type, value and operator used in the following statement.
    
    >>> x = 9


Q 10. What do you mean by assignment operator?

Python Fundamentals Practice Questions Test 5

Q1. Write the output of the following :
>>> x = 8
>>> x = 5
>>> print (x + x)



Q2. Is the following statement correct?
>>> a, b, c = 2 , 3 , 'Amit'



Q3. Identify the invalid variable names from the following and specify the reason also.

a) m_n
b) unit_day
c) 24Apple
d) #sum
e) for
f) s name




Q4. What are keywords?



Q5. Keywords can be used as variable names (T/F)



Q6. Write the code to display all the keywords available in python.



Q7. What do you mean by expression?



Q8. Write the python expressions equivalent to the following algebraic/arithmetic expressions

z = u/5
z = 9ab + d
z = x+4/j + 7


 
Q9. What are operators? Name three types of operators.



Q10. >>> 7 % 10 will return ____________________

Python Fundamentals practice Questions Test 6

Q1. Write the output of the following:

           print("hello * 5")
           print("hello" * 5)
           print("***" * 5)
           print("Hello", "how", "R", "U")
           print("Hello" + "how" + "R" + "U")
           print("Amit" + "Sethi")
           print(23 + 9)
           print ("7 + 9")
           print(7/6)
           print(7//6)
           print(8 % 2)
           print(3 % 7)
           print(4 ** 3)
           print (7 * 5)
           print (8 - 16 )



Q2. What do you mean by string concatenation? Give example


Q3. What do you mean by binary and unary operators? Give one example of each.


Q4. Evaluate the following expressions

23 + 4 **2
9 * 3 - 8 + 6
7%2 + 7//2
67 + 3%3
12 % 4 + 6 + 4 // 3




Q5. Write the name and purpose of the following operators.
//
%
**




Python Fundamentals Practice Questions Test 7

Q1. Out of relational and arithmetic operators which have higher precedence?



Q2. Write the output of the following
>>>35 < 6
>>>5 > 2**2
>>>7 != 3.5 *2
>>>7 == 3.5 ** 2
>>> "Anil" > "Anita"



Q3. What do you mean by shorthand operator?



Q4. Write the output of the following if x = 8.
>>> x + = 8
>>> x - = 8
>>> x * = 8
>>> x ** = 2
>>> x % = 8
>>>x / = 8
>>> x // = 8



Q5. What is the purpose of input function?



Q6. Write a program to accept name from the user and display "Hello <name>"



Q7. Write a program to accept the first name and last name from user and display the full name.



Q8. Write a program to accept two numbers from the user and display their sum and product.



Python Fundamentals Practice Questions Test 8

Q1. What is the difference between eval() and int() function?



Q2. What do you mean by function?



Q3.Write the output of the following
    >>>eval('15')
    >>>eval("6")
    >>>eval(7)
    >>>eval("5 + 8 * 6)



Q4. def command is used to define a function or to call a function.



Q5. Write a user defined function to find the area of rectangle.



Q6. Write a user defined function to print "Python Fundamentals" five times.



Q7. Write a user defined function to find the volume of cube.


       
Q8. All statements in python are terminated by semicolon.(T/F)



Q9. How many spaces are there in one indentation level?



Q10. In python one line can be of maximum ___________ characters.

Python Fundamentals Practice Questions Test 9

Q1. What do you mean by comment in python?


Q2. A comment in python starts with __________ symbol.


Q3. Is python a case sensitive?


Q4. What do you mean by dynamic typing?


Q5. Define the following term

Token
Keyword
String
Operators
int() function
type() function




Q6. Precision of _________ digits in floating point numbers in python.


Q7. input() function always return a value of __________ type.


Q8. Write the output of the following
      >>> x , y = 3, 5
      >>>x, y = y, x + 6
      >>> print(x,y)


Q9. What is the extension of python file?


Q10.  Find the error in the following code
 
    def sub(n1, n2)
    res = n1 - n2
    return res

Python Fundamentals Practice Questions Test 10

Q1. Write a program to accept radius of circle and display it's area and circumference.



Q2. Write a program to find the average marks of five subjects. (Accept marks from user)



Q3. Write a program to find the area of right angle triangle. (Accept base and height from user)



Q4. Write a program to print the following pattern without loop.
*
* *
* * *
* * * *


Q5. Write a program to find the volume of sphere.(Accept radius from the user)



Q6. Find errors

a = input(Enter your name)
b = input("Enter any number")



Q7. Find errors:
    
     a = input("Enter your name"
     Print(Your name is, a)



Q8. Write the output of the following
a, b = 2, 6
a, b, b = a+b, 2, 3
print(a,b)



Q9. Write the output of the following.
    
    a = 5
    b = "Amit"
    print(a + b)



Q10. Write the output of the following.
    
    a =3
    b =4
    print(a + b%2 + a**2)


Class 12 Computer Science Sample Paper 2020-2021.

Class 12 Computer Science Sample Paper Marking Scheme

Class 12 Computer Science Test Series


Share with others

Leave a Reply

%d bloggers like this: