[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

2 / 40

2. Python relies on indentation?

3 / 40

3.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

4 / 40

4. Variable names are case-sensitive

5 / 40

5.

What is the data type of print(type(10))

6 / 40

6. The else keyword catches anything which isn’t caught by the preceding conditions.

7 / 40

7. A variable name cannot start with a number

8 / 40

8.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

9 / 40

9. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

10 / 40

10. To write and execute code in python, we first need to install Python on our system.

11 / 40

11. X wants to allow the program to repeatedly ask the user to enter their Choice if it does not equal the Answer. Which loop option should X use?

a) while Choice == Answer:

Choice = input()

b) while Choice != Answer:

Choice = input()

c) while Answer != Choice:

Choice = input()

d) while Answer =! Choice:

Choice = input()

 

12 / 40

12. Variables that are created outside of a function

13 / 40

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

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

14 / 40

14. You can have if statements inside if statements, this is called nested if statements.

15 / 40

15. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

16 / 40

16. With the break statement we can stop the loop even if the while condition is true

17 / 40

17. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

18 / 40

18.

Which of the following is False?

A. String is immutable.
B. capitalize() function in string is used to return a string by converting the whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole given string into lowercase.
D. None of these.

19 / 40

19. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

20 / 40

20.

What will be the output of above Python code?

str1="6/4"print("str1")

A. 1
B. 6/4
C. 1.5
D. str1

21 / 40

21. Comments can be used to explain Python code.

22 / 40

22. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

23 / 40

23. Extension of all Python  Programme are .py

24 / 40

24. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

25 / 40

25. You can also have an else without the elif

26 / 40

26. Python is a  high-level programming language.

27 / 40

27. Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location

28 / 40

28. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

29 / 40

29.

Choose the correct option with respect to Python.

A. Both tuples and lists are immutable.
B. Tuples are immutable while lists are mutable.
C. Both tuples and lists are mutable.
D. Tuples are mutable while lists are immutable.

30 / 40

30.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

31 / 40

31. print() function is often used to output variables.

32 / 40

32. Comments can be used to make the code more readable.

33 / 40

33. Comments can’t be used to prevent execution when testing code.

34 / 40

34. Which of the following is the correct extension of the Python file?

35 / 40

35.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

36 / 40

36. Python can connect to database systems.

37 / 40

37. Python is an interpreted programming language

38 / 40

38. A variable name can only contain alpha-numeric characters and
underscores

39 / 40

39. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

40 / 40

40. What does the following code print?

x = -10if x < 0:    print("The negative number ",  x, " is not valid here.")print("This is always printed")
a.This is always printedb.The negative number -10 is not valid hereThis is always printedc.The negative number -10 is not valid here

Exit



[hurrytimer id=”2250″]
[wooct_product]

Wrong shortcode initialized


You must log in to see your results.



Wrong shortcode initialized


There are no questions atteched yet.





[ays_quiz_leaderboard id=”Your_Quiz_ID” from=”Y-m-d H:i:sa” to=”Y-m-d H:i:s”]

Category:


Wrong shortcode initialized


[WATU 1]

You must log in to see your results.