[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Camel Case
Each word, except the first, starts with a capital letter:

2 / 40

2.

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

a. 2

b. 3

c. 5

d. Multiple times

3 / 40

3.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

4 / 40

4.

Which is the correct operator for power(xy)?

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

5 / 40

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

6 / 40

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

7 / 40

7. Bitwise operators are used to compare (binary) numbers

8 / 40

8. Comments can be used to explain Python code.

9 / 40

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

10 / 40

10.

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

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

11 / 40

11. Python can be treated in a procedural way, an object-oriented way or a functional way.

12 / 40

12. What will be the output of the following Python code?

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

13 / 40

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

14 / 40

14. You can use the append() method to add an element to an array

15 / 40

15. Python is an interpreted programming language

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

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

20 / 40

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

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. To write and execute code in python, we first need to install Python on our system

23 / 40

23.

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.

24 / 40

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

25 / 40

25. Variable names are case-sensitive

26 / 40

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

27 / 40

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

28 / 40

28. What is the output of the given below program?

if 3 + 4 == 7:    print("Hi")else:    print("Know Program")print("Hello")

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

29 / 40

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

30 / 40

30.

How to copy one list to another in python?

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

31 / 40

31.

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

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

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.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

34 / 40

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

35 / 40

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

36 / 40

36. Comments starts with a #

37 / 40

37. Extension of all Python  Programme are .py

38 / 40

38. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

39 / 40

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

40 / 40

40. Python can connect to database systems.

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.