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,328
| Attempts: 214 | Questions: 9
Please wait...
Question 1 / 9
0 %
0/100
Score 0/100
1. 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?

Explanation

The given subroutine takes in three parameters: a boolean toggle, a string name, and an integer n. It first creates two new strings: strF, which is a substring of name from index 0 to n, and strB, which is the remaining portion of name after removing the first n characters.

If the toggle is true, it sets the text of lblOutput to the concatenation of strF in uppercase and strB in lowercase. In this case, since the toggle is true and the name is "January", the resulting text in lblOutput would be "JANUary".

If the toggle is false, it sets the text of lblOutput to the concatenation of strF in lowercase and strB in uppercase. However, since the toggle is true in this case, this branch of the if statement is not executed.

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

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.

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

Submit
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".

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

Explanation

Remember, character comparisons are case sensitive

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

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.

Submit
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?

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.

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

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.

Submit
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

Explanation

Should be AND, not OR

Submit
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)

Explanation

The given line of code copies the last character in the string "United States" into the variable foo.

Submit
View My Results

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
Cancel
  • All
    All (9)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Consider the following subroutine ...
Consider the following declaration:Dim foobar as String =...
Consider the following declaration:Dim str as String =...
Consider the following code ...
   The function ToUpper() converts a string to upper case.
I'm writing a password generator. Among the changes I will make to...
Are the following if statements equivalent (Do they produce true and...
I want my if statement to be true it my variable intAge is between 18...
What does the the following line of code do? ...
Alert!

Advertisement