Quiz on eval() function
FREE Online Courses: Elevate Your Skills, Zero Cost Attached - Enroll Now!
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
- What does the eval() function return?
CorrectIncorrect -
Question 2 of 15
2. Question
- How many arguments does the function eval() take?
CorrectIncorrect -
Question 3 of 15
3. Question
- Which of the following is the application of eval() function?
CorrectIncorrect -
Question 4 of 15
4. Question
- Which of the following code snippets do not give an error?
CorrectIncorrect -
Question 5 of 15
5. Question
What is the output of the below code?
code=’sorted([1,4,8,2])’
eval(code)CorrectIncorrect -
Question 6 of 15
6. Question
Find the output of the below code if the entered inputs are x**3+6*x+2, 2.
exp=input(‘Enter an expression in x’)
x=int(input(‘Enter the value of x’))
eval(‘exp’)CorrectIncorrect -
Question 7 of 15
7. Question
- Which of the following give the output as True?
CorrectIncorrect -
Question 8 of 15
8. Question
What is the output of the below code?
n=4
eval(‘if(n>0):print(“Number is positive”)’)CorrectIncorrect -
Question 9 of 15
9. Question
- Which of the following code snippets give an error?
CorrectIncorrect -
Question 10 of 15
10. Question
What is the output of the below code if the inputs are ‘cube’ and 5?
def sq(x):
return x*x
def cube(x):
return x**3f_name=input(‘Enter either “sq” or “cube” : ‘)
x=input(‘Enter the number’)
fun=f_name+'(‘+x+’)’
eval(fun)CorrectIncorrect -
Question 11 of 15
11. Question
- What is the second argument of the eval() function?
CorrectIncorrect -
Question 12 of 15
12. Question
- Which of the following is the risk with the eval() function?
CorrectIncorrect -
Question 13 of 15
13. Question
What is the output of below code?
eval(‘dir()’,{})
CorrectIncorrect -
Question 14 of 15
14. Question
What is the output of below code?
import math
a=5
b=6
eval(‘math.ceil(a+b/5)’,{})CorrectIncorrect -
Question 15 of 15
15. Question
What is the output of below code?
from math import *
a=16print(eval(‘sqrt(n)’,{‘__builtins__’: None},{‘sqrt’:sqrt,’n’:a}))
CorrectIncorrect