[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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.

2 / 40

2. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

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

3 / 40

3.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

4 / 40

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

5 / 40

5. Comparison operators are not  used to compare two values

6 / 40

6.

What will be the output of above Python code?

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

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

7 / 40

7. Python is a  high-level programming language.

8 / 40

8. To insert characters that are illegal in a string, use an escape character

9 / 40

9. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

10 / 40

10.

 Select the correct example of complex datatype in Python

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

11 / 40

11. Variable names are case-sensitive

12 / 40

12.

The function can be called in the program by writing function name followed by ____

a. [ ]

b. { }

c. ( )

d. None of the above

13 / 40

13. Snake Case
Each word is separated by an underscore character:

14 / 40

14. Python can be treated in a procedural way, an object-oriented way or a functional way.

15 / 40

15. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

16 / 40

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

17 / 40

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

18 / 40

18. Indentation refers to the spaces at the beginning of a code line.

19 / 40

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

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

20 / 40

20. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

21 / 40

21. Official site of python is www.python.org

22 / 40

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

23 / 40

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

24 / 40

24.

 ____________________ 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

25 / 40

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

26 / 40

26.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

27 / 40

27. You can also have an else without the elif

28 / 40

28. Comments starts with a #

29 / 40

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

30 / 40

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

31 / 40

31.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

32 / 40

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

33 / 40

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

34 / 40

34. You can also have multiple else statements on the same line:

35 / 40

35. python has two primitive loop commands:

  • while loops
  • for loops

36 / 40

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

37 / 40

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

38 / 40

38. The format() method takes the passed arguments

39 / 40

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

40 / 40

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

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.