[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3.

What will be the output of below Python code?

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

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

4 / 40

4. python file can also run on command line

5 / 40

5. Can we write if/else into one line in python?

a) Yes
b) No
c) if/else not used in python
d) None of the above

6 / 40

6.

How to copy one list to another in python?

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

7 / 40

7. Comparison operators are not  used to compare two values

8 / 40

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

9 / 40

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

10 / 40

10.

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

11 / 40

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

12 / 40

12. Python relies on indentation?

13 / 40

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

14 / 40

14.

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.

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

 What is output of: 35 == 35.0

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

20 / 40

20. Extension of all Python  Programme are .py

21 / 40

21. With the break statement we can stop the loop before it has looped through all the items

22 / 40

22.

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

a. 2

b. 3

c. 5

d. Multiple times

23 / 40

23.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

24 / 40

24.

 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.

25 / 40

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

26 / 40

26. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

27 / 40

27.

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

a. [ ]

b. { }

c. ( )

d. None of the above

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

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

a. 5

b. 3

c. 6

d. 7

32 / 40

32. Python is a  high-level programming language.

33 / 40

33.

What is the value of the expression 100 / 25?

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

34 / 40

34.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

35 / 40

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

36 / 40

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

37 / 40

37. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

38 / 40

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

39 / 40

39. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

40 / 40

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

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.