Intro To Cs Second Quarterly

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By KretschK
K
KretschK
Community Contributor
Quizzes Created: 9 | Total Attempts: 7,289
| Attempts: 214
SettingsSettings
Please wait...
  • 1/12 Questions

    Consider the following subroutine Public Sub MakeLabel(ByVal toggle as Boolean, ByVal Name as String,  ByVal n as Integer)         Dim strF as String = name.substring(0, n);         Dim strB as String = name.remove(0, n);         if toggle then            lblOutput.txt = strF.upper() & strB.ToLower()        else             lblOutput.text = strfF.lower() & strB.ToUpper()       endIf End Sub If I run the following statement MakeLabel(True, "January", 4) What is written in the lblOutput label?

Please wait...
Programming Quizzes & Trivia
About This Quiz

This 'Intro to CS Second Quarterly' quiz assesses essential programming skills, focusing on string manipulation, conditional logic, and basic Visual Basic syntax. It's designed to enhance understanding of core computer science principles relevant for beginners.


Quiz Preview

  • 2. 

    Consider the following declaration:Dim foobar as String = "bookkeeper"What is the value of foobar after the following statement?foobar = foobar.replace("bo", "zo")

    Explanation
    The value of foobar after the statement "foobar = foobar.replace("bo", "zo")" is "zookkeeper". The replace() function is used to replace all occurrences of a specified substring with another substring. In this case, it replaces all occurrences of "bo" with "zo" in the string "bookkeeper", resulting in the string "zookkeeper".

    Rate this question:

  • 3. 

    Consider the following declaration:Dim str as String = "success"What is the value of str after the following statement?str = str.Trim("s")

    Explanation
    The given code declares a variable "str" of type String and assigns it the value "success". The next statement "str = str.Trim("s")" trims the letter "s" from the string. So, after executing this statement, the value of "str" will be "ucce".

    Rate this question:

  • 4. 

    Consider the following code Dim guitar as String = "Bruce Springsteen" What is returned from the following statement: guitar.StartsWith("bu")

    • True

    • False

    Correct Answer
    A. False
    Explanation
    Remember, character comparisons are case sensitive

    Rate this question:

  • 5. 

       The function ToUpper() converts a string to upper case.

    • True

    • False

    Correct Answer
    A. True
    Explanation
    The explanation for the given correct answer is that the function ToUpper() indeed converts a string to upper case. This means that if you pass a string as an argument to the ToUpper() function, it will return the same string but with all the characters converted to uppercase letters. Therefore, the statement "The function ToUpper() converts a string to upper case" is true.

    Rate this question:

  • 6. 

    I'm writing a password generator. Among the changes I will make to the input string is to change all instances of the letter 'o' to the digit zero. Which String function would I use?

    • Substring

    • Pad

    • Replace

    • Insert

    Correct Answer
    A. Replace
    Explanation
    The correct answer is "replace". The replace function is used to replace all occurrences of a specified character or substring in a string with another character or substring. In this case, the letter 'o' needs to be replaced with the digit zero, so the replace function would be the appropriate choice to achieve this change in the input string.

    Rate this question:

  • 7. 

    Are the following if statements equivalent (Do they produce true and false under the same conditions?) 1) If intTemp > 98.6 Then ... 2) If Not Temp <= 98.6 Then ...

    • Yes

    • No

    Correct Answer
    A. Yes
    Explanation
    The given if statements are equivalent because they both check if the value of "intTemp" is greater than 98.6. In the first statement, it directly compares "intTemp" with 98.6 using the greater than operator. In the second statement, it checks if "Temp" is not less than or equal to 98.6, which is equivalent to checking if "Temp" is greater than 98.6. Therefore, both statements will produce true and false under the same conditions.

    Rate this question:

  • 8. 

    I want my if statement to be true it my variable intAge is between 18 and 65, inclusive. Does the following if statement work? If 18 <= intAge OR intAge <= 65Then

    • Yes

    • No

    Correct Answer
    A. No
    Explanation
    Should be AND, not OR

    Rate this question:

  • 9. 

    What does the the following line of code do? Dim bar as String = "United States" Dim foo as String = bar.substring(bar.length() - 1, 1)

    • Crashes

    • Copies the last character in United States into the variable foo

    • Copies the first character in United States into the variable foo

    • Its a syntax error

    • Baraksan

    Correct Answer
    A. Copies the last character in United States into the variable foo
    Explanation
    The given line of code copies the last character in the string "United States" into the variable foo.

    Rate this question:

  • 10. 

    Consider a form that has a text box called txtName, a check box called chkMale, a button, and a label called lblAddr. Assume text box also contains the first and last name of a person. Write the code for the button that does the following. Writes into the label the first initial  followed by the last name. If the check box is checked, the name displayed in the label is preceded by "Mr.", otherwise it is preceded by "Ms."  For example, if the check box is checked, and the text box contains "Pete Seeger", the label should contain "Mr. P Seeger". If the check box is not checked and the text box contains "Joan Baez", the label should contain "Ms. J Baez".

  • 11. 

    Consider the String variable strSchool which equals "Middletown South". What is the difference between the expression strSchool.substring(3,6) and strSchool.remove(3, 6)?

  • 12. 

    Consider three variables intAmount, dblCost, and dblShipping, which contain the number of items purchased, the cost of each item, and the shipping charge. Write the code that calculates the total cost of the order. Keep in mind that if the cost of each item is over 100 dollars or the customer orders at least 10 items, shipping is free.

Quiz Review Timeline (Updated): Mar 18, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 18, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 29, 2014
    Quiz Created by
    KretschK
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.