1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PilotLPTM [1.2K]
3 years ago
11

What is the output of the code snippet given below?string s = "abcde";int i = 1;while (i < 5){ cout << s.substr (i, 1);

i++;}a. no outputb. abcdc. abcde d. bcde
Computers and Technology
1 answer:
Ronch [10]3 years ago
4 0

Answer:

The answer is "Option d".

Explanation:

In the given C++ program code, two-variable is defined, that is "s and i", in which variable s is a string type that holds a value, that is "abcde", and variable i is an integer type, that holds a value '1'.

  • In the next line, a while loop is declared, that uses integer variable which value is less than 5, inside a loop a substring function is used, that specifies the number of character and return its value.  
  • In array and string indexing starts from 0, and that variable i starts from 1, that is used in substring function, that's why it will print only "bcde".
You might be interested in
Write a Java program to accept an item's name and price from the user and output them to the console
Anit [1.1K]

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read inputs

Scanner scr=new Scanner(System.in);

 // variables

String name;

   double price;

   System.out.print("Enter item's name: ");

   // read item's name

   name = scr.next();

   System.out.print("Enter item's price: ");

   // read item's price

   price= scr.nextDouble();

   // print name

   System.out.println("name of item is:"+name);

   // print price

   System.out.println("price of item is:"+price);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read name & price of item from user and assign it to variables "name" & "price" respectively with scanner object.Then print the name and price of item .

Output:

Enter item's name: Apple                                                                                                  

Enter item's price: 100                                                                                                    

name of item is:Apple                                                                                                      

price of item is:100.0

6 0
2 years ago
PLEASE HELP
Lunna [17]

Answer:

Spreadsheets is a software like Microsoft excel

3 0
2 years ago
Read 2 more answers
Select the correct answer from the drop-down menu.
AnnyKZ [126]

you can right click the target cell or cells and then select the keys to paste the copled data.

3 0
3 years ago
Read 2 more answers
Which of these best describes cloud computing? A. an on-demand service that helps to access shared computing and storage resourc
Basile [38]
I think its A. an on-demand service that helps to access shared computing and storage resources from anywhere using an Internet connection
5 0
2 years ago
Calculate the time necessary to perform a multiply using the approach described in the text (31 adders stacked vertically) if an
Rudiy27

The time that will be used to perform a multiplication using the approach is 28 time units.

<h3>How to calculate time taken?</h3>

From the information given, the following can be noted:

A = 8 (bits wide)

B = 4 time units.

The multiplication will be performed based on the adder stack. Since A = 8, then, A - 1 = 8 - 1 = 7.

Now, the time taken will be:

= 7 × B

= 7 × 4tu

= 28 tu

In conclusion, the correct option is 28 time units.

Learn more about time taken on:

brainly.com/question/10428039

5 0
2 years ago
Other questions:
  • PLEASE HELP!
    13·2 answers
  • Answers please !!!!!!!!!!!!!!!!!!!!!!!!!!!
    8·1 answer
  • Write a method so that the main() code below can be replaced by the simpler code that calls method mphandminutestomiles(). origi
    14·2 answers
  • What command can be used to export an nps backup file named npsconfig.xml that can be used to restore nps configuration on anoth
    12·1 answer
  • You interact with a program through which of the following, thereby controlling how you enter data and instructions and how info
    5·2 answers
  • Count the number of words in the string. A word is one or more non-blank characters separated by one or more blanks. My suggesti
    13·1 answer
  • The person responsible for setting goals and schedules, monitoring work, motivating the team, and reporting progress to managers
    7·1 answer
  • Where in PowerPoint should a user navigate to complete the tasks listed below?
    6·1 answer
  • Guys, please help me asap (Photo Attached) !!!!!!! HELP 25pts!!!!
    14·2 answers
  • Privacy, anonymity, and freedom of expression are all interrelated.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!