XII CS PT1 cloned 9/17/2020
star
star
star
star
star
Last updated about 5 years ago
27 questions
Note from the author:
XII CS PT-1
1
Q1. A Function in python begins with keyword_____.
Q1. A Function in python begins with keyword_____.
1
Q2. Name the statement that sends back value from a function.
Q2. Name the statement that sends back value from a function.
1
Q3. A variable declared or defined within function body is known as _______
Q3. A variable declared or defined within function body is known as _______
1
Q4. What is the output of the program given below?x=20def func(x): x=2func(x)print('x is now',x)
Q4. What is the output of the program given below?
x=20
def func(x):
x=2
func(x)
print('x is now',x)
1
Q5. More than one value(s) can be returned by a function in Python.
Q5. More than one value(s) can be returned by a function in Python.
1
Q6. The variable declared inside the function is called a global variable.
Q6. The variable declared inside the function is called a global variable.
1
Q7. A local variable having the same name as that of a global variable hides the global variable in its function.
Q7. A local variable having the same name as that of a global variable hides the global variable in its function.
1
Q8. Built in functions are created by users and are not a part of python library.
Q8. Built in functions are created by users and are not a part of python library.
1
Q9. The first line of a function header begins with def keyword and ends with a colon(:)
Q9. The first line of a function header begins with def keyword and ends with a colon(:)
1
Q10. The variable declared out siide all the functions is called __________
Q10. The variable declared out siide all the functions is called __________
4
Q11. What will be the output of the following code? 4def func(a,b=2,c=0.10): return(a*b*c)
print(func(6100,1))print(func(5000,c=0.05))print(func(5000,3,0.12))print(func(b=4,a=5000))
Q11. What will be the output of the following code? 4
def func(a,b=2,c=0.10):
return(a*b*c)
print(func(6100,1))
print(func(5000,c=0.05))
print(func(5000,3,0.12))
print(func(b=4,a=5000))
2
Q12 write a python function SUM to sum the numbers in a list Sample List [4,6,3,5,6]Expected output:24
Q12 write a python function SUM to sum the numbers in a list
Sample List [4,6,3,5,6]
Expected output:24
2
Q13. Write a python function to print the sum of even numbers from a given list
Q13. Write a python function to print the sum of even numbers from a given list
2
Q14. What is the difference between local variable and global variable?
Q14. What is the difference between local variable and global variable?
3
Q15. What possible output(s) are expected import randomAR=[20,30,40,50,60,70]FROM=random.randint(1,3)TO=random.randint(2,4)for K in range(FROM,TO+1): print(AR[K],end="#")
Q15. What possible output(s) are expected
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print(AR[K],end="#")
1
Which of the following commands can be used to read “n”number of characters from a file using the file object named file
Which of the following commands can be used to read “n”number of characters from a file using the file object named file
1
Which of the statements are true for read()
Which of the statements are true for read()
1
CSV files store data in
CSV files store data in
1
Identify the correct option to open a file c:\text.dat for appending in Python Program
Identify the correct option to open a file c:\text.dat for appending in Python Program
1
format is a text format, accessible to all applications across several platforms
format is a text format, accessible to all applications across several platforms
1
method is used for random access of data in a CSV file
method is used for random access of data in a CSV file
1
method of pickle module is used to write an object into binary file
method of pickle module is used to write an object into binary file
1
method of pickle module is used to read data from a binary file
method of pickle module is used to read data from a binary file
1
Which of the following is not a valid mode to open a file?
Which of the following is not a valid mode to open a file?
3
Write a user-defined function in python that displays the number lines starting with 'H' in the file 'Para.txt'
Write a user-defined function in python that displays the number lines starting with 'H' in the file 'Para.txt'
3
Write a function countmy() in Python to read the text file "Data.Txt" and count the number of times "my" occurs in the file.
Write a function countmy() in Python to read the text file "Data.Txt" and count the number of times "my" occurs in the file.
2
Differentiate between file modes r+ and w+
Differentiate between file modes r+ and w+