[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

2 / 40

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

3 / 40

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

4 / 40

4. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

5 / 40

5. You can also use the remove() method to remove an element from the array

6 / 40

6.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

7 / 40

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

8 / 40

8. Variable names are case-sensitive

9 / 40

9. Operators are used to perform operations on variables and values

10 / 40

10.

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

a. 2

b. 3

c. 5

d. Multiple times

11 / 40

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

12 / 40

12. The format() method takes the passed arguments

13 / 40

13.

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

14 / 40

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

15 / 40

15.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

16 / 40

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

17 / 40

17.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

18 / 40

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

19 / 40

19. You can use the append() method to add an element to an array

20 / 40

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

21 / 40

21.

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.

22 / 40

22. python has two primitive loop commands:

  • while loops
  • for loops

23 / 40

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

24 / 40

24.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

25 / 40

25.

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

26 / 40

26. Arrays are used to store multiple values in one single variable.

27 / 40

27. Find and write the output of the following python code:

x = “abcdef”

i = “a”

while i in x:

print(i, end = ” “)

a) a

b) a a a a a a

c) a a a a a a … infinite times

d) Code will generate error

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

31. Python can be install on both  Linux and  Windows

32 / 40

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

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

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

33 / 40

33.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

34 / 40

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

 

35 / 40

35.

What is the data type of print(type(0xFF))

36 / 40

36.

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

37 / 40

37. An array can hold many values under a single name

38 / 40

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

39 / 40

39. We can combine strings and numbers by using the format() method

40 / 40

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

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.