[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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.

2 / 40

2.

 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.

3 / 40

3.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

4 / 40

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

5 / 40

5. Comparison operators are not  used to compare two values

6 / 40

6.

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

7 / 40

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

8 / 40

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

9 / 40

9.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

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. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

12 / 40

12.

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

13 / 40

13.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

14 / 40

14.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

15 / 40

15.

Which function overloads the >> operator?

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

16 / 40

16. The format() method takes the passed arguments

17 / 40

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

18 / 40

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

19 / 40

19.

What will be the output of below Python code?

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

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23.

 ____________________ 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

24 / 40

24.

 What is output of: 35 == 35.0

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

25 / 40

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

26 / 40

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

27 / 40

27. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

28 / 40

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

29 / 40

29. An array is a special variable, which can hold more than one value at a time

30 / 40

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

31 / 40

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

32 / 40

32.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

33 / 40

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

34 / 40

34. The length of an array is always one more than the highest array index.

35 / 40

35. With the for loop we can execute a set of statements

36 / 40

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

37 / 40

37. Comments starts with a #

38 / 40

38. Is there any comments in  following codes

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

 

39 / 40

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

40 / 40

40. Who developed Python 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.