[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

What will be the output of below Python code?

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

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

2 / 40

2.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

3 / 40

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

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

4 / 40

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

5 / 40

5. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

6 / 40

6. Official site of python is www.python.org

7 / 40

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

8 / 40

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

9 / 40

9. Comparison operators are not  used to compare two values

10 / 40

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

11 / 40

11.

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

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

12 / 40

12.

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

13 / 40

13. To insert characters that are illegal in a string, use an escape character

14 / 40

14.

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

15 / 40

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

16 / 40

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

17 / 40

17. Pip is  not a powerful package management system for Python software packages

18 / 40

18. Comments starts with a #

19 / 40

19.

 ____________________ 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

20 / 40

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

21 / 40

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

22 / 40

22.

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

23 / 40

23. python has two primitive loop commands:

  • while loops
  • for loops

24 / 40

24.

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

25 / 40

25.

Which is the correct operator for power(xy)?

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

26 / 40

26. Python is an interpreted programming language

27 / 40

27. What is the output of the given below program?

if 3 + 4 == 7:    print("Hi")else:    print("Know Program")print("Hello")

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

28 / 40

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

29 / 40

29.

What is the value of the expression 100 / 25?

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

30 / 40

30. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

31 / 40

31.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

32 / 40

32. Python has various versions available

33 / 40

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

34 / 40

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

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. You can also have multiple else statements on the same line:

37 / 40

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

38 / 40

38. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

39 / 40

39. Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location

40 / 40

40.

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

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.