[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

2 / 40

2. Variable names are case-sensitive

3 / 40

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

4 / 40

4.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

5 / 40

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

6 / 40

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

7 / 40

7. python file can also run on command line

8 / 40

8. With the for loop we can execute a set of statements

9 / 40

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

10 / 40

10.

 What is output of: 35 == 35.0

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

11 / 40

11. Python can connect to database systems.

12 / 40

12. + operator is used  to get output of multiple variables

13 / 40

13.

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

14 / 40

14.

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

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.

 Select the correct example of complex datatype in Python

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

17 / 40

17. Most recent major version of Python is Python 3

18 / 40

18. Pascal Case
Each word starts with a capital letter:

19 / 40

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

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

20 / 40

20.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

26. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

27 / 40

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

28 / 40

28. The format() method takes unlimited number of arguments

29 / 40

29.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

30 / 40

30. An array is a special variable, which can hold more than one value at a time

31 / 40

31. Python can be used on a server to create web applications?

32 / 40

32. 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()

 

33 / 40

33. You can also have an else without the elif

34 / 40

34. The for loop does not require an indexing variable to set beforehand

35 / 40

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

36 / 40

36.

 ____________________ 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

37 / 40

37.

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

38 / 40

38.

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.

39 / 40

39. Comments can be used to explain Python code.

40 / 40

40. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

Exit



Hurry Up!

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