Question
Question 1 (1 point) Curly braces { } are required for any if - else statement that is controlling more than 1 line of code.
Question 1 (1 point)
Curly braces { } are required for any if - else statement that is controlling more than 1 line of code.
Question 1 options:
True | |
False |
Question 2 (1 point)
In nested loops, the break operator will terminate all of the nested loops.
Question 2 options:
True | |
False |
Question 3 (1 point)
A loop that doesnt make progress towards completion is known as:
Question 3 options:
| foreach loop |
| while loop |
| infinite loop |
| do-while loop |
Question 4 (1 point)
The structure of a for loop is: for (initialization; condition; update) { loop's body; }. Which of the following are illegal?
Question 4 options:
| for(; ; ) {} |
| for(int i=10; i>0; i--) {} |
| for(int j=5;j<100;j+=5){} |
| none, all are legal |
Question 5 (1 point)
How many times will this loop run?
for(int i=0; i>=10;i+=10)
{
//doing something
}
Question 5 options:
| 10 |
| 11 |
| 0 |
| 1 |
Question 6 (1 point)
What output does the following code store in the string s?
string s = "Four: " + 2 + 2;
Question 6 options:
| Four: 4 |
| Four: 2 + 2 |
| Four: 22 |
| none of these |
Question 7 (1 point)
How many times will the following loop run?
int x=5;
while(x<10)
{
x*=-2;
}
Question 7 options:
| 0 |
| 1 |
| 2 |
| 3 |
Question 8 (1 point)
The continue statement stops the current iteration of the loop by skipping to the end then proceeding with the next iteration.
Question 8 options:
True | |
False |
Question 9 (1 point)
When a string is involved in concatenation with any other type the result is always a string.
Question 9 options:
True | |
False |
Question 10 (1 point)
Consider the string object having the value of "This is fun". The substring method that takes one value is given a parameter of 5. Is the result "is fun"?
Question 10 options:
True | |
False |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started