Questions: 1 680

Answers by our Experts: 1 680

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

One metric ton is approximately 2205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, in a bag. The program outputs the number of bags needed to store one metric ton of rice.



As many of the students like chats, chips, juice and chocolates, a vending machine is kept at several places. The person after putting the cash has to enter the product code so as to get it.

The code is as follows

Code Product

106 Haldiram Ratmali Sev

206 Haldiram Instant Bhel

306 Fuse Chocolate

406 Mixed Fruit Juice

506 Lassi

Depending on the code entered the item will be selected and given to the person who feeds the amount. An application has to be developed so that it automatically works after entering the code.


Peter runs a vehicle rental center. The vehicles are of three types, MICRO, MINI and SUV. The customer who travels in MICRO will pay Rs 15 per kilometer. The customer who travels in MINI will pay Rs 20 per kilometer and the customer who travels in SUV will pay Rs 25 per kilometer.

A software need to be developed to compute the cost of travelling by the customer with following requirements.

a. The distance travelled by customer need to be captured.

b. The type of vehicle to be captured (M for Micro, m for mini, S for SUV).

c. Check the type of vehicle.

d. Compute the final cost of the travel depending on the vehicle.

Display the final cost.


Delhi government has issued a circular to control the pollution due to vehicle. It has prohibited the use of odd numbers registered vehicle on Monday, Wednesday and Friday and not to use even number registered vehicles on Tuesday, Thursday and Saturday. Sunday they have to use public transport so no vehicle should be used.


A software application is to be developed by Delhi Government which will inform the owner of the vehicle on which day they can use the vehicle.

Following are the requirements to solve the problem

a. The registration number of the vehicle should be captured from the owner.

b. Check if the registration number is odd or even.

c. Inform user on which day they can use the vehicle.


Class Coordinator of the section 01 wants to select the student class representative. A student is eligible to become class representative if he/she has scored minimum of 75% in 12th Standard and less than 15K ranking in the entrance test.

A software needs to be developed to help Class coordinator to select the class representative.

1. Students rank in entrance test should be captured.

2. Students 12th percentage should be captured.

3. Check if rank is less than 15k and 12th percentage is more than 75%

4. If both the criteria is true, Display Eligible.

5. If any one of the criteria is false, Display Not Eligible.


1. In the following program, what would be the final output? Explain in


detail.


v oid c o p y a r r ( ch a r ∗p1 , ch a r p2 [ ] ) {


memcpy ( p2 , p1 , s i z e o f ( p1 ) ) ;


memcpy ( p2 , ‘ ‘ABCD’ ’ , 4 ) ;


}


i n t main ( ) {


ch a r a r r 1 [ 1 0 0 ] ;


ch a r a r r 2 [ 1 0 0 ] ;


p r i n t f ( ‘ ‘ Enter a s t r i n g : ’ ’ ) ;


s c a n f ( ‘ ‘%[ ˆ\n ] s ’ ’ , a r r 1 ) ;


c o p y a r r ( a r r 1 , a r r 2 ) ;


p r i n t f ( ‘ ‘ \ n %s ’ ’ , a r r 2 ) ;


r e t u r n 0 ;


}


2. Consider the following program:


i n t main ( v oid ) {


i n t a = 2 , ∗b = NULL;


b = &a ;


p r i n t f ( ‘ ‘%p ’ ’ , b + 1 ) ;


p r i n t f ( ‘ ‘%p ’ ’ , ( ch a r ∗) b + 1 ) ;


p r i n t f ( ‘ ‘%p ’ ’ , ( v oid ∗) b + 1 ) ;


}



Suppose the address of a is equal to 0x1000. What is the output of the


above program? Explain in detail.


What to submit:


• Write-up describing an explanation for the output (i.e. why you observe


what you observe), for both the cases.


Let us say that you have a program that uses SCHED_FIFO scheduling. How


would the vruntime variable for such a program be computed or updated ?





How is this different from how vruntime would be updated for SCHED_RR and


SCHED_NORMAL ?


What would be the output of the following program? Explain.


i n t main ( )


{


p i d t pid 1 ;


p r i n t f ( ‘ ‘ b e f o r e f o r k ( ) ’ ’ ) ;


i f ( ( pid 1=f o r k ()) >0)


{


w ai t pi d ( pid1 , NULL, 0 ) ;


}


e l s e i f ( pid 1 == 0 ) {


e x e c l ( ‘ ‘ / u s r / bin / bash ’ ’ , ‘ ‘ bash ’ ’ ,NULL ) ;


p r i n t f ( ‘ ‘ done l a u n c hi n g the s h e l l ’ ’ ) ;


}


e l s e {


p e r r o r ( ‘ ‘ f o r k ( ) ’ ’ ) ;


}


}



What to submit:


• Write-up describing an explanation for the output (i.e. why you observe


what you observe).


Two code snippets are being presented to you.


1. mov rax, 0x1234567812345678


xor ax, 0x11


mov rdi, ax


call printf


xor rax, 0x11


mov rdi, rax


call printf






2. int x=-2;


unsigned int y = -33;


int z;


z = x + y;


printf(‘‘%u %u %u’’, x,y,z);


printf(‘‘%d %d %d’’, x,y,z);



In both the parts (1) and (2), explain what the two printf function calls


result in. Explain the reasons for any differences in the two cases.


Try to compile the following code snippet (no need to link).

char add(float a,float b)

{

return (int)(round (a)+round (b)) ;

}

Would the compilation of this code snippet result in errors or warnings?

Would this code, if compiled and linked with a full fledged program result in

any logical errors? Answer both parts accurately.


What to submit:

• Command (with appropriate arguments) that were used to compile the

snippet.

• A writeup showing all the compilation errors and warnings that you may

have encountered and their possible explanations, along with the logical

errors (if any if you think there are, i.e.).


LATEST TUTORIALS
APPROVED BY CLIENTS