[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

2 / 40

2. Python will give you an error if you skip the indentation

3 / 40

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

4 / 40

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

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

7 / 40

7. Most recent major version of Python is Python 3

8 / 40

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

9 / 40

9.

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

10 / 40

10.

How to copy one list to another in python?

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

11 / 40

11.

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

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

12 / 40

12.

In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type:

  1. False
  2. True

13 / 40

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

14 / 40

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

15 / 40

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

16 / 40

16. Python can connect to database systems.

17 / 40

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

18 / 40

18.

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.

19 / 40

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

20 / 40

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

21 / 40

21.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

22 / 40

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

23 / 40

23. Variables that are created outside of a function

24 / 40

24.

What is the data type of print(type(10))

25 / 40

25. Python has various versions available

26 / 40

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

27 / 40

27.

 What is output of: 35 == 35.0

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

28 / 40

28.

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

29 / 40

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

30 / 40

30.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

31 / 40

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

32 / 40

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

33 / 40

33. The list’s remove() method only removes the first occurrence of the specified value.

34 / 40

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

35 / 40

35.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

36 / 40

36. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

40. Python relies on indentation?

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.