Python Application Programming Quiz 1 : Klsvdit

24 Questions | Attempts: 1456
Share

SettingsSettingsSettings
Python Application Programming Quiz 1 : Klsvdit - Quiz


Questions and Answers
  • 1. 
    Write your text here
  • 2. 
    Write your text here
  • 3. 
    What is a correct syntax to output "Hello World" in Python?
    • A. 

      Print("Hello World")

    • B. 

      P("Hello World")

    • C. 

      Echo "Hello World"

    • D. 

      Echo("Hello World");

  • 4. 
    A string is immutable in Python? Every time when we modify the string, Python Always create a new String and assign a new string to that variable.
    • A. 

      True

    • B. 

      False

  • 5. 
    What is the output of the following code? var1 = 1 var2 = 2 var3 = "3" print(var + var2 + var3)
    • A. 

      6

    • B. 

      321

    • C. 

      123

    • D. 

      Error. Mixing operators between numbers and strings are not supported

  • 6. 
    Which operator has higher precedence in the following list
    • A. 

      **, Exponent

    • B. 

      & BitWise AND

    • C. 

      % Modulus

    • D. 

      >< Comparison

  • 7. 
    What is the output of the following code? str = "pynative" print (str[1:3])
    • A. 

      Py

    • B. 

      Yn

    • C. 

      Pyn

    • D. 

      Yna

  • 8. 
    Which one is NOT a legal variable name?
    • A. 

      _myvar

    • B. 

      Myvar

    • C. 

      My_var

    • D. 

      My-var

  • 9. 
    What is the output of the following code? p, q, r = 10, 20 ,30 print(p, q, r)
    • A. 

      10,20

    • B. 

      Invalid syntax

    • C. 

      10,20,30

  • 10. 
    What is the output of the following x = 36 / 4 * (3 + 2) * 4 + 2 print(x)
    • A. 

      182

    • B. 

      The Program executed with errors

    • C. 

      37

    • D. 

      117

  • 11. 
    Var = "KLS" * 2 * 3 print(var)
    • A. 

      KLSKLSKLSKLSKLSKLS

    • B. 

      Syntax Error

    • C. 

      KLSKLS

    • D. 

      KLSKLSKLS

  • 12. 
    Can we use the “else” clause for loops? for example: for i in range(1, 5): print(i) else: print("this is else block statement" )
    • A. 

      Yes

    • B. 

      No

  • 13. 
    What is the output of the following code? listOne = [20, 40, 60, 80] listTwo = [20, 40, 60, 80] print(listOne == listTwo) print(listOne is listTwo)
    • A. 

      True True

    • B. 

      True False

    • C. 

      False True

    • D. 

      False False

  • 14. 
    How do you create a variable with the floating number 2.8?
    • A. 

      X = float(2.8)

    • B. 

      X =2.8

    • C. 

      Both the other answers are correct

  • 15. 
    What is the correct syntax to output the type of a variable or object in Python?
    • A. 

      Print(type(x))

    • B. 

      Print(typeof x)

    • C. 

      Print(typeof(x))

    • D. 

      Print(typeOf(x))

  • 16. 
    What is the correct way to create a function in Python?
    • A. 

      Function myfunction():

    • B. 

      Create myFunction():

    • C. 

      Def myFunction():

  • 17. 
    What is a correct syntax to return the first character in a string?
    • A. 

      X = sub("Hello", 0, 1)

    • B. 

      X = "Hello"[0]

    • C. 

      X = "Hello".sub(0, 1)

  • 18. 
    Which method can be used to return a string in upper case letters?
    • A. 

      Upper()

    • B. 

      Toupper()

    • C. 

      Uppercase()

    • D. 

      UpperCase()

  • 19. 
    Which method can be used to replace parts of a string?
    • A. 

      Repl()

    • B. 

      Replace()  

    • C. 

      ReplaceString()

    • D. 

      Switch()

  • 20. 
    Which of these collections defines a LIST?
    • A. 

      ("apple", "banana", "cherry")  

    • B. 

      {"name": "apple", "color": "green"}

    • C. 

      {"apple", "banana", "cherry"}

    • D. 

      ["apple", "banana", "cherry"]  

  • 21. 
    Which of these collections defines a TUPLE?
    • A. 

      ("apple", "banana", "cherry")  

    • B. 

      ["apple", "banana", "cherry"]

    • C. 

      {"apple", "banana", "cherry"}

    • D. 

      {name: "apple", "banana", "cherry"}

  • 22. 
    Which of these collections defines a SET?
    • A. 

      {name: "apple", "banana", "cherry"}  

    • B. 

      ("apple", "banana", "cherry")

    • C. 

      ["apple", "banana", "cherry"] 

    • D. 

      {"apple", "banana", "cherry"}  

  • 23. 
    Which collection is ordered, changeable, and allows duplicate members?
    • A. 

      LIST

    • B. 

      SET

    • C. 

      DICTIONARY

    • D. 

      TUPLE

  • 24. 
    How do you start writing an if statement in Python?
    • A. 

      If x > y then:

    • B. 

      If x > y:

    • C. 

      If (x > y)

  • 25. 
    Which statement is used to stop a loop?
    • A. 

      Exit

    • B. 

      Break

    • C. 

      Stop

    • D. 

      Return

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.