[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. Extension of all Python  Programme are .py

4 / 40

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

5 / 40

5. Variable names are case-sensitive

6 / 40

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

7 / 40

7. Pascal Case
Each word starts with a capital letter:

8 / 40

8. A variable name can only contain alpha-numeric characters and
underscores

9 / 40

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

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 allows you to extract the values into variables.

12 / 40

12. You can also use the remove() method to remove an element from the array

13 / 40

13.

 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.

14 / 40

14.

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

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

15 / 40

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

16 / 40

16. You can also have an else without the elif

17 / 40

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

18 / 40

18.

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

19 / 40

19.

How to copy one list to another in python?

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

20 / 40

20. Most recent major version of Python is Python 3

21 / 40

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

22 / 40

22.

 What is output of: 35 == 35.0

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

23 / 40

23.

Which is the correct operator for power(xy)?

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

24 / 40

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

25 / 40

25.

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.

26 / 40

26.

What is the data type of print(type(0xFF))

27 / 40

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

28 / 40

28. python has two primitive loop commands:

  • while loops
  • for loops

29 / 40

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

30 / 40

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

31 / 40

31.

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

a. [ ]

b. { }

c. ( )

d. None of the above

32 / 40

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

33 / 40

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

34 / 40

34.

Choose the correct option with respect to Python.

A. Both tuples and lists are immutable.
B. Tuples are immutable while lists are mutable.
C. Both tuples and lists are mutable.
D. Tuples are mutable while lists are immutable.

35 / 40

35.

What will be the output of below Python code?

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

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

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

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.