[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

3 / 40

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

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. Bitwise operators are used to compare (binary) numbers

6 / 40

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

7 / 40

7. python has two primitive loop commands:

  • while loops
  • for loops

8 / 40

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

9 / 40

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

10 / 40

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

11 / 40

11. You can also have an else without the elif

12 / 40

12.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

13 / 40

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

14 / 40

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

15 / 40

15.

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

a. Define

b. DEF

c. def

d. Def

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

20 / 40

20.

 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.

21 / 40

21.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

22 / 40

22. You can use the pop() method to remove an element from the array

23 / 40

23. Comments starts with a #

24 / 40

24.

 Select the correct example of complex datatype in Python

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

25 / 40

25.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

26 / 40

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

27 / 40

27.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

28 / 40

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

29 / 40

29. During Installation Make sure to select both the checkboxes at the bottom .

30 / 40

30. Comments can be used to explain Python code.

31 / 40

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

32 / 40

32. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

33 / 40

33. A variable name must start with a letter or the underscore character

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. print() function is often used to output variables.

36 / 40

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

37 / 40

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

38 / 40

38. Who developed Python Programming Language?

39 / 40

39.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

40 / 40

40.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. 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.