[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

2 / 40

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

3 / 40

3. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

4 / 40

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

5 / 40

5.

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

6 / 40

6. A variable name cannot start with a number

7 / 40

7.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

8 / 40

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

9 / 40

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

10 / 40

10.

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.

11 / 40

11. python has two primitive loop commands:

  • while loops
  • for loops

12 / 40

12. An array can hold many values under a single name

13 / 40

13. python file can also run on command line

14 / 40

14. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

15 / 40

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

16 / 40

16.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

17 / 40

17.

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

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

18 / 40

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

19 / 40

19. Extension of all Python  Programme are .py

20 / 40

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

21 / 40

21.

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

22 / 40

22.

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

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

28 / 40

28. Python has various versions available

29 / 40

29.

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

30 / 40

30.

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

a. 2

b. 3

c. 5

d. Multiple times

31 / 40

31. Variables that are created outside of a function

32 / 40

32.

What will be the output of below Python code?

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

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

33 / 40

33.

What is the value of the expression 100 / 25?

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

34 / 40

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

35 / 40

35. Variable names are case-sensitive

36 / 40

36. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

37 / 40

37.

 ____________________ 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

38 / 40

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

a. 5

b. 3

c. 6

d. 7

39 / 40

39.

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

a. Define

b. DEF

c. def

d. Def

40 / 40

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

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.