[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

2 / 40

2.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

3 / 40

3. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

4 / 40

4. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

5 / 40

5.

What will be the output of above Python code?

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

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

6 / 40

6.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

7 / 40

7. 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

8 / 40

8. You can return a range of characters by using the slice syntax

9 / 40

9. Python  was created by Guido van Rossum, and released in 1999.

10 / 40

10. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

11 / 40

11. Pip is  not a powerful package management system for Python software packages

12 / 40

12. Find the output of the following program segments:

for i in range(20,30,2):

print(i)

a) 20 22 24 26 28

b) 20

22

24

26

28

c) 20 22 24 26 28 30

d) 20

22

24

26

28

30

13 / 40

13. 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))

14 / 40

14.

In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type:

  1. False
  2. True

15 / 40

15.

What is the value of the expression 100 / 25?

  1. 4
  2. 4.0
  3. 0
  4. 25

16 / 40

16. The len() method to return the length of an array

17 / 40

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

18 / 40

18. Arithmetic operators are used with numeric values to perform common mathematical operations

19 / 40

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

20 / 40

20. The format() method takes the passed arguments

21 / 40

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

22 / 40

22. 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

23 / 40

23.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

24 / 40

24. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

25 / 40

25. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

26 / 40

26. 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

27 / 40

27. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

28 / 40

28. Find the output of the given Python program?

a, b, c = 1, 3, 5if a > 0:  if b < 2:    print("Hi")  elif c > 3:    print("Hello")else:  print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

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. Python allows you to extract the values into variables.

31 / 40

31.

 ____________________ 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

32 / 40

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

33 / 40

33.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

34 / 40

34. Python can connect to database systems.

35 / 40

35. Variable names are case-sensitive

36 / 40

36. 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

37 / 40

37. Python relies on indentation?

38 / 40

38. Python has a set of built-in methods that you can use on lists/arrays

39 / 40

39. Strings in python are surrounded by either single quotation marks, or double quotation marks

40 / 40

40.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

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.