[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

2 / 40

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

3 / 40

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

4 / 40

4.

 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.

5 / 40

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

6 / 40

6.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

7 / 40

7.

How to copy one list to another in python?

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

8 / 40

8.

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

a. 2

b. 3

c. 5

d. Multiple times

9 / 40

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

10 / 40

10.

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

11 / 40

11.

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.

12 / 40

12.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

13 / 40

13.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

14 / 40

14. Comments can be used to make the code more readable.

15 / 40

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

16 / 40

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

17 / 40

17. Most recent major version of Python is Python 3

18 / 40

18. Variable names are case-sensitive

19 / 40

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

20 / 40

20.

 What is output of: 35 == 35.0

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

21 / 40

21. Comments can be used to explain Python code.

22 / 40

22.

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.

23 / 40

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

24 / 40

24.

What will be the output of below Python code?

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

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

25 / 40

25. Python is an interpreted programming language

26 / 40

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

27 / 40

27.

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

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

28 / 40

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

29 / 40

29.

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

30 / 40

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

31 / 40

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

32 / 40

32.

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

33 / 40

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

34 / 40

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

35 / 40

35.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

36 / 40

36.

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

a. [ ]

b. { }

c. ( )

d. None of the above

37 / 40

37.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

38 / 40

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

39 / 40

39.

What will be the output of above Python code?

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

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

40 / 40

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

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.