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
Rama09 [41]
3 years ago
13

Given a String variable named sentence that has been initialized, write an expression whose value is the number of characters in

the String referred to by sentence.
Computers and Technology
1 answer:
Troyanec [42]3 years ago
5 0
Python:

sentence = “this is the sentence.”
size = len(sentence)

C++:

string sentence = “this is the sentence.”
int size = sentence.size()

* Remember strings are just arrays of characters.

You might be interested in
The computer uses unallocated space for what​
finlep [7]

A computer uses unallocated space also know as free space to keep a file that has been deleted in its disk until a new file takes it spot and overwrites it.

3 0
3 years ago
Read 2 more answers
Locker doors There are n lockers in a hallway, numbered sequentially from 1 to n. Initially, all the locker doors are closed. Yo
kow [346]

Answer:

// here is code in C++

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int n,no_open=0;

   cout<<"enter the number of lockers:";

   // read the number of lockers

   cin>>n;

   // initialize all lockers with 0, 0 for locked and 1 for open

   int lock[n]={};

   // toggle the locks

   // in each pass toggle every ith lock

   // if open close it and vice versa

   for(int i=1;i<=n;i++)

   {

       for(int a=0;a<n;a++)

       {

           if((a+1)%i==0)

           {

               if(lock[a]==0)

               lock[a]=1;

               else if(lock[a]==1)

               lock[a]=0;

           }

       }

   }

   cout<<"After last pass status of all locks:"<<endl;

   // print the status of all locks

   for(int x=0;x<n;x++)

   {

       if(lock[x]==0)

       {

           cout<<"lock "<<x+1<<" is close."<<endl;

       }

       else if(lock[x]==1)

       {

           cout<<"lock "<<x+1<<" is open."<<endl;

           // count the open locks

           no_open++;

       }

   }

   // print the open locks

   cout<<"total open locks are :"<<no_open<<endl;

return 0;

}

Explanation:

First read the number of lockers from user.Create an array of size n, and make all the locks closed.Then run a for loop to toggle locks.In pass i, toggle every ith lock.If lock is open then close it and vice versa.After the last pass print the status of each lock and print count of open locks.

Output:

enter the number of lockers:9

After last pass status of all locks:

lock 1 is open.

lock 2 is close.

lock 3 is close.

lock 4 is open.

lock 5 is close.

lock 6 is close.

lock 7 is close.

lock 8 is close.

lock 9 is open.

total open locks are :3

5 0
3 years ago
5. Create a vector called to20 that goes from 1 to 20 (use the range notation). Now create a variable called end that goes from
Lady_Fox [76]

Answer:

creating vector:

code:  

to20 <-c(1:20) #creating to20 vector

end <-c(40:50) #creating end vector

to50 <-c(to20,21:30,end) # creating to50 vector

print(to50) # printing to50 vector

Explanation:

8 0
3 years ago
What is data backup short definition ​
Molodets [167]

Answer: See explanation

Explanation:

Data backup simply has to.do with the creation of a copy of data on a system which is stored so that it can then be recovered in a case whereby there's data loss or in a situation whereby the original data is corrupt.

Data backup is also vital in case when someone wants to recover some files which have already been deleted.

7 0
3 years ago
Consider the code block below. What is the value of amount when this method is called twice, the first time using cookieJar(7) a
RUDIKE [14]

Answer:

C. 22

Explanation:

Given that the argument is being passed by value, there is no memory to consider.  So cookieJar(7) returns 7 and cookieJar(22) returns 22.

If the argument parameter was passed by reference or pointer, then perhaps the value from cookieJar(7) would be considered with cookieJar(22).

Note, this code block really isn't doing anything other than returning the value passed into it.  The "amount" variable is immediately set to 0, and then the value passed in is added to amount (which is 0), and returns.  The following code could replace this function:

public static int cookieJar(int addCookies){

return addCookies;

}

The above code will return an equivalent output to the given code.

Notice, the function is not dependent on any previous call, so the value for each is unique to the call itself, i.e., cookieJar(22) returns 22 and cookieJar(7) returns 7.

So, C. 22 would be correct.

3 0
3 years ago
Other questions:
  • Mary wants to rearrange the slides of her presentation. Which option should she use?
    9·1 answer
  • After a normal system shutdown, when the computer is turned off, contents of the memory used to store bios settings are
    12·2 answers
  • In three to five sentences, describe how technology helps business professionals to be more efficient. Include examples of hardw
    10·1 answer
  • Almost all application programs are designed to run with a specific platform. Group of answer choices True False
    15·1 answer
  • When you print ____, the presentation is printed with one or more slides on each piece of paper?
    11·1 answer
  • What did major networks do to combat audience erosion in the 1990s?
    15·1 answer
  • What is human data,
    8·1 answer
  • What are 2 ways to access the vendor credit screen in quickbooks online?
    13·1 answer
  • Capstone Project part 11 quiz
    6·1 answer
  • 9.18 lab: even/odd values in a vector write a program that reads a list of integers, and outputs whether the list contains all e
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!