[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Is there any comments in  following codes

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

 

2 / 40

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

a. 5

b. 3

c. 6

d. 7

3 / 40

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

4 / 40

4.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

5 / 40

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

6 / 40

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

7 / 40

7.

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

a. [ ]

b. { }

c. ( )

d. None of the above

8 / 40

8.

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

a. Define

b. DEF

c. def

d. Def

9 / 40

9. python file can also run on command line

10 / 40

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

11 / 40

11. Extension of all Python  Programme are .py

12 / 40

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

13 / 40

13.

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

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

14 / 40

14.

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

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

21.

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

22 / 40

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

23 / 40

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

24 / 40

24.

 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.

25 / 40

25.

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

26 / 40

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

27 / 40

27. Python  was created by Guido van Rossum, and released in 1999.

28 / 40

28.

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

29 / 40

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

30 / 40

30. What will be the output of the following Python code?

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

31 / 40

31.

What will be the output of above Python code?

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

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

32 / 40

32.

Which is the correct operator for power(xy)?

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

33 / 40

33.

What will be the output of below Python code?

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

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

34 / 40

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

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.

Which function overloads the >> operator?

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

37 / 40

37.

What is the value of the expression 100 / 25?

  1. 4
  2. 4.0
  3. 0
  4. 25

38 / 40

38. Operators are used to perform operations on variables and values

39 / 40

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

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.