[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. The else keyword catches anything which isn’t caught by the preceding conditions.

3 / 40

3.

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

4 / 40

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

5 / 40

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

6 / 40

6. Python relies on indentation?

7 / 40

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

8 / 40

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

9 / 40

9.

 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.

10 / 40

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

11 / 40

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

12 / 40

12. print() function is often used to output variables.

13 / 40

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

14 / 40

14. Python has various versions available

15 / 40

15.

What will be the output of below Python code?

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

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

16 / 40

16.

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

17 / 40

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

18 / 40

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

19 / 40

19.

Which is the correct operator for power(xy)?

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

20 / 40

20.

 Select the correct example of complex datatype in Python

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

21 / 40

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

22 / 40

22. The format() method takes the passed arguments

23 / 40

23. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

24 / 40

24.

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

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

25 / 40

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

26 / 40

26. The format() method takes unlimited number of arguments

27 / 40

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

28 / 40

28.

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

29 / 40

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

30 / 40

30. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

31 / 40

31.

How to copy one list to another in python?

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

32 / 40

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

33 / 40

33.

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

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

34 / 40

34.

What will be the output of below Python code?

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

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

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

39. Variables that are created outside of a function

40 / 40

40. Python is an interpreted programming language

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.