Programming Quiz: Conditional Statements And Strings!

15 Questions | Total Attempts: 41

SettingsSettingsSettings
Please wait...
Programming Quizzes & Trivia

Are you a programmer looking for a trivia quiz on conditional statements and strings? The quiz below is designed to help you see just how much you know about the basic symbols in a string and how one should write a given code. Do give it a try and get a chance to refresh your understanding so far, Al the best!


Questions and Answers
  • 1. 
    Consider the following code Dim foo as String = "Chuck Berry" What is returned from the following statement: foo.EndsWith("ry")
    • A. 

      True

    • B. 

      False

  • 2. 
    Consider the following code Dim foo as String = "Chuck Berry" Dim bar as String = "Chuck Schumer" What is returned from the following statement: foo > bar
    • A. 

      True

    • B. 

      False

  • 3. 
    String comparisons are always case sensitive.
    • A. 

      True

    • B. 

      False

  • 4. 
    An If statement always needs an Else statement.
    • A. 

      True

    • B. 

      False

  • 5. 
    When comparing these two strings, the expression "Zebra" < "aardvark" is...
    • A. 

      True

    • B. 

      False

  • 6. 
    Consider the following code Dim intA as Integer = 6 Dim intB as Integer = 0 Dim intC as Integer = -1 Is the following expression true or false? If int A < int B OR intC < int B Then
    • A. 

      True

    • B. 

      False

  • 7. 
    Consider the following code Dim foo as String = "Elvis Presley" What is returned from the following statement: foo.length()
  • 8. 
    Consider the following variable Dim foobar as String = "Roy Orbison" What is returned by the following statement: foobar.substring(4, 4)
  • 9. 
    Consider the following code Dim foo as String = "Little Richard" What is returned from the following statement: foo.remove(3,2)
  • 10. 
    Consider the following code Dim foo as String = "Snoopy" What is returned from the following statement: foo.trimright("y")
  • 11. 
    Consider the following code Dim foo as String = "Snoop Dogg" What is returned from the following statement: foo.indexOf("g")
  • 12. 
    Consider the following code Dim foo as String = "Patty Page" What is returned from the following statement: foo.insert(6, "aa");
  • 13. 
    Consider the following code: Dim s as Integer = txtName.Text.indexOf(" ")  if s = 0 Then      lblNick.Text = txtName.Text & "san" Else      lblNick.Text.padleft("Dr. " EndIf If I type "Barak Obama" into the Name textbox, what is printed in the Nick label?
    • A. 

      Obamasan

    • B. 

      Dr. Barak Obama

    • C. 

      Barak Obamasan

    • D. 

      Dr. Obama

    • E. 

      Baraksan

  • 14. 
    The condition in an If structure must always evaluate to _____.  
    • A. 

      0 or 1

    • B. 

      -1 or 0

    • C. 

      Negative or positive

    • D. 

      True or false

  • 15. 
    The comparison that checks if a variable called intAge is at least 18 is:
    • A. 

      If intAge > 18 Then

    • B. 

      If intAge

    • C. 

      If intAge >= 18 Then

    • D. 

      If IntAge < 18 Then