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

Exercise 2: Battery Model

it is capable of storing, and the energy it is currently storing (in joules).

(b) Define a function PowerDevice that takes as arguments: a current of an electrical device (amps), a battery of type

BatteryModel, and the time the device is to be powered by the battery (seconds), and determines whether the battery's

energy reserve is adequate to power the device.

If so, the function updates its reserve by subtracting the energy consumed

and returns the value 1.

Otherwise it returns the value 0 and leaves the energy reserve unchanged.

(c) Define a function MaxTime that takes as arguments: a current of an electrical device and a battery of type BatteryModel,

and returns the number of seconds this battery can operate the device before it is fully discharged.

(d) Define a function Recharge that sets a battery of type BatteryModel representing the present energy reserve to its maxi-

the battery's remaining energy could power an 8-A device.


1. C language is an example of imperative / procedural language, but since it is old (no OO or functional programming allowed), is no more required to industry.

True or False

2. Considering an ANSI C compiler what can represent a lexical error?

a. a = )a+(b;

b. a = 0.0a;

c. if (a=3) a++;

d. a = α{"version":"1.1","math":"α"}~b;



Theory questions about Compilers

1 When you are setting a bit flag (position "p"), what is the mask that you need to use and what is the operation required? What is supposed to be the mask value for reset and what is the operation? Give one example.

2.

In the buffer code, identify the problems if:

(a) You do not use a temporary variable to realloc buffer;

(b) You do not test the buffer before each function.

(c) You do not free the memory in case of error

3. In buffer, what is the purpose for setting bits EOB (end of buffer) and RLC (rellocation) and in which functions it is supposed to happen?

4. Is it possible to change buffer.h constants and typedefs that do not require modifications in the code of buffer.c? Explain and give an example.


Write a C Program Management System to Rent a cycle on hourly basis


Per hour charges. Rs. 90 /hour




10 cycles


25 clients


90 per hr charges


Reports


Monthly bill of all cyclists


Every client don't take cycle on rent at daily basis but Can take regular and more than one hour daily


Exercise 1: Largest contiguous partial sum

(a) Write a function that will find the largest contiguous partial sum, LagestSum, within an array of real numbers. That is,

we want to sum up any number of neighboring elements from the array, starting from anywhere, find the largest possible

sum.

-3 4 2 1 -4 6 -10 0 -4 3

then the function should report return 9, because 4+2+1+(-4)+6= 9 is the largest sum of contiguous elements from

that array of numbers. The function must also provide the starting and the ending indices of the summed elements back

to its caller(indices 1 and 5 for the example above).

(b) Write a driver program that tests the function LargesttSum written in (a).


In online journal system, the user has to give detail information about their abstract of the manual script before upload of source document. The abstract submitted by the author should not more than 300 words. The journal system uses program to count the number of vowels, consonants, digits and symbols in a given paragraph. Write a program to count the number of vowels, consonants, digits and symbols using pointers as reference to the function.



Runtime Input :


1=>see-programming.blogspot.com



Output :


No. of vowels: 8

No. of consonants: 17

No. of digits: 1

No. of symbols: 1

Others: 4


Just modify the code in Part C in the following manner: 1. int array[8] should be replaced by the char array[] = “EENG112 Introduction to Programming” 2. modify call_by_reference array so that its input is char* and it modifies its input as follows: a. Each vowel is replaced by a character “1”, b. Each consonant is replaced by a character “0”. 3. print_1D_array should be modified to print the character sequence. Keep the original form of code in Part C, just make required modifications.


Write a program to delete all vowels from a sentence. Assume that the sentence is not 

more than 80 characters long.


Write a program that replaces two or more consecutive blanks in a string by a single 

blank. For example, if the input is Grim return to the planet of apes!! 

 the output should be Grim return to the planet of apes!!.


Write a program to count the number of occurrences of any two vowels in succession 

in a line of text. For example, in the sentence 

“Pleases read this application and give me gratuity” such occurrences are ea, ea, ui.


LATEST TUTORIALS
APPROVED BY CLIENTS