[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. + operator is used  to get output of multiple variables

3 / 40

3.

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

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

4 / 40

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

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. You can also have an else without the elif

7 / 40

7.

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

8 / 40

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

9 / 40

9.

 ____________________ 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

10 / 40

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

11 / 40

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

a. 5

b. 3

c. 6

d. 7

12 / 40

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

13 / 40

13. Snake Case
Each word is separated by an underscore character:

14 / 40

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

15 / 40

15.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

16 / 40

16. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

17 / 40

17. Arithmetic operators are used with numeric values to perform common mathematical operations

18 / 40

18.

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

19 / 40

19.

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

a. 2

b. 3

c. 5

d. Multiple times

20 / 40

20.

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

21 / 40

21. You can return a range of characters by using the slice syntax

22 / 40

22.

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.

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

26.

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.

27 / 40

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

28 / 40

28.

Which function overloads the >> operator?

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

29 / 40

29. python file can also run on command line

30 / 40

30. python has two primitive loop commands:

  • while loops
  • for loops

31 / 40

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

32 / 40

32. Indentation refers to the spaces at the beginning of a code line.

33 / 40

33. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

34 / 40

34. Comments starts with a #

35 / 40

35. You can also have multiple else statements on the same line:

36 / 40

36.

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

37 / 40

37. What does the following code print?

x = -10if x < 0:    print("The negative number ",  x, " is not valid here.")print("This is always printed")
a.This is always printedb.The negative number -10 is not valid hereThis is always printedc.The negative number -10 is not valid here

38 / 40

38. Python has various versions available

39 / 40

39.

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

40 / 40

40.

 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.

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.