[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

3 / 40

3. Python can be used to handle big data and perform complex mathematics.

4 / 40

4.

What will be the output of above Python code?

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

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

5 / 40

5.

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

6 / 40

6.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

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

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

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 the Python statement x = a + 5 – b:

a and b are ________a + 5 - b is ________
  1. terms, a group
  2. operators, a statement
  3. operands, an expression
  4. operands, an equation

15 / 40

15.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

16 / 40

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

17 / 40

17. Python is an interpreted programming language

18 / 40

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

19 / 40

19. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

20 / 40

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

21 / 40

21.

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

a. Define

b. DEF

c. def

d. Def

22 / 40

22.

What will be the output of below Python code?

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

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

23 / 40

23.

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

a. [ ]

b. { }

c. ( )

d. None of the above

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

27. A variable name cannot start with a number

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

32.

Which is the correct operator for power(xy)?

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

33 / 40

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

34 / 40

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

35 / 40

35. Python will give you an error if you skip the indentation

36 / 40

36.

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

37 / 40

37.

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.

38 / 40

38. The length of an array is always one more than the highest array index.

39 / 40

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

40 / 40

40.

What will be the output of below Python code?

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

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

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.