[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

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

a. 2

b. 3

c. 5

d. Multiple times

3 / 40

3.

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

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

4 / 40

4.

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.

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

8.

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

9 / 40

9.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

10 / 40

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

11 / 40

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

12 / 40

12.

How to copy one list to another in python?

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

13 / 40

13.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

14 / 40

14. Variables that are created outside of a function

15 / 40

15. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

16 / 40

16.

Which of the following statements assigns the value 25 to the variable x in Python:

  1. x ← 25
  2. x = 25
  3. x := 25
  4. int x = 25
  5. x << 25

17 / 40

17. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

18 / 40

18. Python  was created by Guido van Rossum, and released in 1999.

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. The list’s remove() method only removes the first occurrence of the specified value.

21 / 40

21. You can have if statements inside if statements, this is called nested if statements.

22 / 40

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

23 / 40

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

24 / 40

24. Python allows you to extract the values into variables.

25 / 40

25. python has two primitive loop commands:

  • while loops
  • for loops

26 / 40

26.

What will be the output of above Python code?

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

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

27 / 40

27.

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

a. True

b. False

28 / 40

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

29 / 40

29.

l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?

  1. List
  2. Tuple
  3. Set
  4. None of these

30 / 40

30. Python can be install on both  Linux and  Windows

31 / 40

31.

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

32 / 40

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

33 / 40

33. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

38.

 What is output of: 35 == 35.0

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

39 / 40

39. Which of the following is the correct extension of the Python file?

40 / 40

40.

 Select the correct example of complex datatype in Python

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

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.