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
vaieri [72.5K]
3 years ago
10

Write a function that takes a character string value and prints out the bytes stored in memory of its representation (including

the terminating 0). Test it on a string containing your full name.
Computers and Technology
1 answer:
Goryan [66]3 years ago
6 0

Answer:

C++ code explained below

Explanation:

SOURCE CODE:

*Please follow the comments to better understand the code.

#include <stdio.h>

int numOfBytes(char* string)

{

// initialise the variables

int i=0,size=0;

// while the string reaches to \0, repeat the loop.

while(string[i]!='\0')

{

// add that size

size += sizeof(*string);

 

// increase the i value.

i++;

}

// add 1 byte for \0

size = size+1;

return size;

}

int main() {

char name[]="Praveen Kumar Reddy";

printf("The size is %d bytes.",numOfBytes(name));

 

  return 0;

}

=============

You might be interested in
Which of the following occurs during data cleansing?
Diano4ka-milaya [45]

Answer:c)Clean redundant customer data

Explanation:Data cleansing/cleaning is the activity for the elimination of the data which is not required for further use, corrupt, unnecessary etc by detecting it. The data that is being cleared is categorized by levels like irrelevant  data, incorrect data, inaccurate data, redundant data etc.

The data is eliminated by the method of correcting , modifying, reducing unnecessary parts,deleting, etc.Thus, the correct option is option(C).

5 0
3 years ago
What is Roko's Basilisk?
serious [3.7K]

Answer:

Roko’s basilisk is a thought experiment proposed in 2010 by the user Roko on the Less Wrong community blog. Roko used ideas in decision theory to argue that a sufficiently powerful AI agent would have an incentive to torture anyone who imagined the agent but didn't work to bring the agent into existence.

7 0
3 years ago
Angelina wants to modify the footer in her report so the page numbers are correct. To do this, she first double-clicks the foote
Mkey [24]

Answer:

Click Page Number, Click Current Position, Click Plain Number 1.

Explanation:

Just did it, e2020

4 0
3 years ago
Using Module operator, write a java program to print odd number between 0 and 1000​
jolli1 [7]

Answer:

class OddNumber

{

  public static void main(String args[])  

       {

         int n = 1000;  //Store 1000 in Variable n typed integer

         System.out.print("Odd Numbers from 1 to 1000 are:");  // Print headline of output window

         for (int i = 1; i <= n; i++)  //For loop to go through each number till end

          {

            if (i % 2 != 0)  //check if number is even or odd.Not divisible by 2 without reminder means it is odd number

             {

               System.out.print(i + " "); //print odd numbers

             }

          }

       }

}              

5 0
3 years ago
I need the SQL statements for these questions:
zimovet [89]

Answer:

Explanation:

/* From the information provided, For now will consider the name of table as TRIPGUIDES*/

/*In all the answers below, the syntax is based on Oracle SQL. In case of usage of other database queries, answer may vary to some extent*/

1.

Select R.Reservation_ID, R.Trip_ID , C.Customer_Num,C.Last_Name from Reservation R, Customer C where C.Customer_Num=R.Customer_Num ORDER BY C.Last_Name

/*idea is to select the join the two tables by comparing customer_id field in two tables as it is the only field which is common and then print the desired result later ordering by last name to get the results in sorted order*/

2.

Select R.Reservation_ID, R.Trip_ID , R.NUM_PERSONS from Reservation R, Customer C where C.Customer_Num=R.Customer_Num and C.LAST_NAME='Goff' and C.FIRST_NAME='Ryan'

/*Here, the explaination will be similar to the first query. Choose the desired columns from the tables, and join the two tables by equating the common field

*/

3.

Select T.TRIP_NAME from TRIP T,GUIDE G,TRIPGUIDES TG where T.TRIP_ID=TG.TRIP_ID and TG.GUIDE_NUM=G.GUIDE_NUM and G.LAST_NAME='Abrams' and G.FIRST_NAME='Miles'

/*

Here,we choose three tables TRIP,GUIDE and TRIPGUIDES. Here we selected those trips where we have guides as Miles Abrms in the GUIDES table and equated Trip_id from TRIPGUIDES to TRIP.TRIP_Name so that can have the desired results

*/

4.

Select T.TRIP_NAME

from TRIP T,TRIPGUIDES TG ,G.GUIDE

where T.TRIP_ID=TG.TRIP_ID and T.TYPE='Biking' and TG.GUIDE_NUM=G.GUIDE_NUM and G.LAST_NAME='Boyers' and G.FIRST_NAME='Rita'

/*

In the above question, we first selected the trip name from trip table. To put the condition we first make sure that all the three tables are connected properly. In order to do so, we have equated Guide_nums in guide and tripguides. and also equated trip_id in tripguides and trip. Then we equated names from guide tables and type from trip table for the desired results.

*/

5.

SELECT C.LAST_NAME , T.TRIP_NAME , T.START_LOCATION FROM CUSTOMER C, TRIP T, RESERVATION R WHERE R.TRIP_DATE='2016-07-23' AND T.TRIP_ID=R.TRIP_ID AND C.CUSTOMER_NUM=R.CUSTOMER_NUM

/*

The explaination for this one will be equivalent to the previous question where we just equated the desired columns where we equiated the desired columns in respective fields and also equated the common entities like trip ids and customer ids so that can join tables properly

*/

/*The comparison of dates in SQL depends on the format in which they are stored. In the upper case if the

dates are stored in the format as YYYY-MM-DD, then the above query mentioned will work. In case dates are stored in the form of a string then the following query will work.

SELECT C.LAST_NAME , T.TRIP_NAME , T.START_LOCATION FROM CUSTOMER C, TRIP T, RESERVATION R WHERE R.TRIP_DATE='7/23/2016' AND T.TRIP_ID=R.TRIP_ID AND C.CUSTOMER_NUM=R.CUSTOMER_NUM

*/

6.

Select R.RESERVATION_ID, R.TRIP_ID,R.TRIP_DATE FROM RESERVATION R WHERE R.TRIP_ID IN

{SELECT TRIP_ID FROM TRIP T WHERE STATE='ME'}

/*

In the above question, we firstly extracted all the trip id's which are having locations as maine. Now we have the list of all the trip_id's that have location maine. Now we just need to extract the reservation ids for the same which can be trivally done by simply using the in clause stating print all the tuples whose id's are there in the list of inner query. Remember, IN always checks in the set of values.

*/

7.

Select R.RESERVATION_ID, R.TRIP_ID,R.TRIP_DATE FROM RESERVATION WHERE

EXISTS {SELECT TRIP_ID FROM TRIP T WHERE STATE='ME' and R.TRIP_ID=T.TRIP_ID}

/*

Unlike IN, Exist returns either true or false based on existance of any tuple in the condition provided. In the question above, firstly we checked for the possibilities if there is a trip in state ME and TRIP_IDs are common. Then we selected reservation ID, trip ID and Trip dates for all queries that returns true for inner query

*/

8.

SELECT G.LAST_NAME,G.FIRST_NAME FROM GUIDE WHERE G.GUIDE_NUM IN

{

SELECT DISTINCT TG.GUIDE_NUM FROM TRIPGUIDES TG WHERE TG.TRIPID IN {

SELECT T.TRIP_ID FROM TRIP T WHERE T.TYPE='Paddling'

}

}

/*

We have used here double nested IN queries. Firstly we selected all the trips which had paddling type (from the inner most queries). Using the same, we get the list of guides,(basically got the list of guide_numbers) of all the guides eds which were on trips with trip id we got from the inner most queries. Now that we have all the guide_Nums that were on trip with type paddling, we can simply use the query select last name and first name of all the guides which are having guide nums in the list returned by middle query.

*/

4 0
2 years ago
Other questions:
  • NEED ASWERS FAST
    12·1 answer
  • What is the maximum amount that OSHA can impose as a penalty on an employer for each Willful violation?
    11·1 answer
  • Communication of a message between two processes implies which of the following? (A) Synchronization (B) Atomic operation (C) Bl
    11·1 answer
  • Jack used primarily web sources for his informative speech about gun control. however, his over-reliance on the web site sponsor
    11·1 answer
  • What decides the amount of delay between shots on a digital camera?
    7·1 answer
  • Give me at least five main characteristic of irrigation equipment​
    8·1 answer
  • Procedural programs specify instructions that a processor must execute to perform computations. These programs sometimes consist
    11·1 answer
  • Help! Picture provided
    7·2 answers
  • Which key combination should you use
    9·2 answers
  • What is system software?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!