Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

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

Write the exact output of the following algorithms:

1.1 Study the following array in an algorithm called arr. Indicate what the values in arr would be after the given code has been executed. 4 6 8 10 120 14 15 99 102 55 for x = 0 to 9 if arr(x) Mod 2 = 0 then arr(x) = arr(x) + 5

endif

if x Mod 2 = 0 then

arr(x) = arr(x) + 1

endif

next x

x = x – 5

for y = 2 to 8 step 2

arr(y) = arr(x) + y next y

for z = 1 to 6 step 3

arr(z) = z * y + x next z


Students in Programming 1 would like to understand the concept of Ohm’s law. You are

required to write an application that will help students to calculate the voltage in an electric

circuit using the formula below.

V = IR

Where V= volatge

I = Current

R- Resistance




Current

0.62

14.89

13.21

16.55

18.62

9.47

6.58

18.32

12.15

3.98

Resistance Voltage

4.0        0

8.5        0

6.0        0

7.35       0

9.0        0

15.3       0 

3.0        0

5.4        0

2.9        0

4.8        0


Write a C++ application that will help the students to understand the concepts:

4.1 Create a C++ called Circuit and save it in a file called Circuit.cpp.

4.2 Declare all necessary variables and constants.

4.3 Declare two parallel arrays named current, resistance and initialise them using the

information given above.

4.4 Declare another parallel array called voltage populate by calling using default values.


4.5 Create a menu that will iterate until the user enters an invalid number. Create this menu

by calling the function menus. There are five possible menu selections numbered from

1 to 7, if the user enters 8 or any other number the program must terminate.


NB: Make use of the switch statement for the menu selection.

Menu

Option

Description

1 Display all

 Display all circuit details as shown in Figure 4.1.

2 Search volts: (See Figure 4.2)

 The user must be prompted to enter the volts that he or she would like to

search for.

 The volts must then be searched in the corresponding array.

o If the value is found or not an appropriate message must be

display as shown in Figure 4.2.

3 Search volts and indicate where it was found : (See Figure 4.2)

 The user must be prompted to enter the volts that he or she would like

to search for.

 The volts must then be searched in the corresponding array.

o If the value is found it must display the value, the index at which

it was found as well as the number of eminent for that particular

volatge or an appropriate message must be display as shown in

Figure 4.2.

4 Find the highest voltage (See Figure 4.3)

 Display the highest voltage.

5 Find highest volatge with corresponding details: (See Figure 4.3)

 Display the highest volts with their corresponding details

6 Display average volatge (See Figure 4.4).

 Calculate and display average voltage.

7 Display number of measurements that are above the average volatge (See

Figure 4.4).

8 or any

other key

Exit : (See Figure 4.5)


An array called number contains 20 integer values and must be filled with values in the following way:

 Fill the array with consecutive even numbers starting from 10.

 Start again at the first element and increase every fourth element with 3

.  Replace the value of the first four elements each with its square.

 Deduct 2 from the last 3 elements.

 Swap the value of element 5 and element 15

.  Add the value of the first element to that of the last element

 Add consecutive integers (starting from 1) to all even elements. Remember, the first element has a subscript of 0 and the last element (element 20) has a subscript of 19.



The following must be displayed:

 All elements must be displayed each on a new line. Identify each element clearly

.  Display the highest value in the array.

 The lowest value in the array must be displayed.

 Count and display how many even values and how many odd values the array contains.


2.1 Study the following descriptions and write only the statements to achieve the required objectives in both algorithm and C++ syntax.



2.1.1 The array called quantity has 20 elements. Write statements that will help in counting how many of these elements have a value of less than 50. Also determine the sum of the values that are more than or equal to 50. Display these 2 answers.


2.1.2 The array called itemPrice has 150 elements. Write the statements to determine and display the highest price. If there is more than one item with this price, the number of items must also be displayed.


2.1.3Three corresponding arrays of 250 elements each contain the following respectively: employee number, department and annual salary. Write only the statements to calculate the monthly salary for each and every employee. The following must be displayed the department and employee number of every employee who earns more than R100 000 per annum.


2.1.4 Three corresponding arrays of 250 elements each contain the following respectively: employee number, department and annual salary. The following must be displayed the department and employee number as well as the monthly salary of each employee that must be stored in a fourth parallel array called monSalay.


1. Objectives

The main objective of this project is to let you know in more detail the design and description process of a Management Information Base (MIB). A simple case will be studied and treated with the formalism dictated by SMI-v2 described by RFC 1213.

2. Introduction

SMI-v2 uses only a very small subset of ASN.1 and has few templates to formally describe an information base.

RFC 1213 gives the formalism to use a description of a MIB that will be handled with the SNMP protocol. This project will therefore ask you to familiarize yourself with this RFC.

3. Presentation of the context and design of the MIB

You should design a private Management Information Base to supervise a host. The goal is to use SNMP to communicate the information to a network management application and to be able to automatically control the state, generate useful reports and possibly detect performance or security issues.

- What information would be required to manage a host?

- Distinguish between the simple variables and their types, and the tables necessary for this information base.

 

4. Formal description of the MIB

For this part, we will offer you a simplified MIB in the Appendix. According to an informal description, you must format this MIB in accordance with the SMI-v2 standard. Pay particular attention to how a table should be described, and to the DESCRIPTION field of each object.

- Name the module containing the MIB using the following format: studentName-StudentID-MIB,

- Choose the OID (Object Identifier) ​​of each element,

- Define a coherent tree structure,

- Use the ASN.1 syntax for the types of the elements.

-Write the complete MIB in text format using the SMI-v2 standard (refer to the tutorial of SMI)

 5. Appendix

The elements to consider for the design of the MIB are:


1- Percentage of free CPU "freeCPULoad"

2- Percentage of unallocated memory "freeMemoryLoad"

3- If the workstation is an "isWebServer" web server

4- The operating system version "version"

5- The old start date of the "lastHostReboot" system

6- The number of current users that are logged into the "usersNumber" workstation

7- A table of these users: "usersTable"

8- The user's login name, "userId"

9- The date of the opening of the session, "userLoginDate"

 


A particle of mass M1 moving with initial velocity  is incident on a stationary particle of mass M2.After collision, M1 was deflected through an angle  and M 2 an angle .If the velocity of the particles after collision were  and  respectively.Show that for an elastic collision;

(a)    = 2


(b)   =2 +



(c)    =


Compute Z-transform of the following signals along with the RoC and verify the result with MATLAB result and attach screen shot of code and results:

(a) 𝑥(𝑛) = (1/𝑅𝐹) 𝑛𝑢(𝑛) + (1/𝑅𝐿) 𝑛𝑢(𝑛)

where RF = 12 RL = 56

Also take inverse Z-transform of computed X(z) and verify the result on page as well as in MATLAB.


Part 1


As an exercise, use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. (Downey, 2015)


After the final stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with different arguments.


Include all of the following in your Learning Journal:


An explanation of each stage of development, including code and any test input and output.

The output of hypotenuse(3,4).

The output of two additional calls to hypotenuse with different arguments.


Part 2


Invent your own function that does some useful computation of your choosing. Do not copy the function from somewhere else. Use incremental development, and record each stage of the development process as you go. Finally, print output that demonstrates that the function works as you intended.


Include all of the following in your Learning Journal:


An explanation of each stage of development, including code and any test input and output.

The output of three calls to your function with different arguments.



Do Exercise 6.4 from your textbook using recursion and the is_divisible function from Section 6.4. Your program may assume that both arguments to is_power are positive integers. Note that every positive integer that has an exponent of 0 is a power of "1". This includes "0" and "1", itself.


After writing your is_power function, include the following test cases in your script to exercise the function and print the results:


print("is_power(10, 2) returns: ", is_power(10, 2))

print("is_power(27, 3) returns: ", is_power(27, 3))

print("is_power(1, 1) returns: ", is_power(1, 1))

print("is_power(10, 1) returns: ", is_power(10, 1))

print("is_power(3, 3) returns: ", is_power(3, 3))


Write the exact output of the following algorithms:

1.1 Study the following array in an algorithm called arr. Indicate what the values in arr would be after the given code has been executed.

4

6

8

10

120

14

15

99

102

55

for x = 0 to 9

if arr(x) Mod 2 = 0 then

arr(x) = arr(x) + 5

endif

if x Mod 2 = 0 then

arr(x) = arr(x) + 1

endif

next x

x = x – 5

for y = 2 to 8 step 2


arr(y) = arr(x) + y

next y

for z = 1 to 6 step 3

arr(z) = z * y + x

next z


LATEST TUTORIALS
APPROVED BY CLIENTS