subject

Consider the following code segment:

String word = "Cafeteria";
for(/* missing condition */)
{
System. out. print(word. substring(i+1,i+2) + " ");
}

The code segment is intended to print every other letter in the word, starting with index 0, to produce the result C f t r a. Which of the following can be used to replace /* missing condition */ so that the code segment works as intended?

int i = 0; i < word. length(); i+=2

int i = -1; i < word. length(); i+=2

int i = 0; i < word. length(); i++

int i = -1; i <= word. length(); i+=2

int i = word. length() - 1; i < -1 ; i-=2

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:20
An ou structure in your domain has one ou per department, and all the computer and user accounts are in their respective ous. you have configured several gpos defining computer and user policies and linked the gpos to the domain. a group of managers in the marketing department need different policies that differ from those of the rest of the marketing department users and computers, but you don't want to change the top-level ou structure. which of the following gpo processing features are you most likely to use? a, block inheritance b, gpo enforcement c, wmi filtering d, loopback processing
Answers: 3
question
Computers and Technology, 24.06.2019 02:00
What is a loop? a. a collection of function definitions at the top of a program b. a line of code that defines a variable and assigns it a value c. a program that opens the turtle graphics window d. a block of code that repeats a specific number of times
Answers: 1
question
Computers and Technology, 25.06.2019 09:20
Problem 3: (hand) write the member function implementations for the class hand, which simulates a hand of 2 cards, into the file hand.cpp. the relative strength of 2 hands are determined by the following rules: • a pair (two cards of the same number) is the strongest hand. • two cards of the same suit is the next strongest hand. • two cards of different numbers and suits is the weakest hand. • within the same kind of hands, the stronger hand is determined by the larger number. • if two hands are of the same kind and the larger numbers are the same, the stronger hand is given by the hand whose smaller number is larger. • if all above fails, the two hands are of equal strength. i.e., all suits are of equal strength. • 2 is the weakest number. an ace is stronger than a king. you are using a single deck of cards. so a hand of a♥a♥ is impossible. here are some examples:
Answers: 3
question
Computers and Technology, 25.06.2019 18:00
Bigmart supermarket has different ways of awarding discounts to its customers for each purchase they make. an 8 percent discount is given on the total value of the purchase. in addition, a standard loyalty discount is given if customers have a permanent customer id card. your program should indicate the amount payable by the customer after the discounts. identify the inputs that the program requires from these options: i. the discount percentage ii. the total value of the purchase iii. the loyalty-discount amount iv. the customer id card number v. the amount payable after discount
Answers: 2
You know the right answer?
Consider the following code segment:

String word = "Cafeteria";
for(/* missing con...
Questions
question
Social Studies, 19.08.2019 20:30
Questions on the website: 13722361