Answer:
Codes for each of the problems are explained below
Explanation:
PROBLEM 1 IN C++:
#include<iostream>
using namespace std;
//fib function that calculate nth integer of the fibonacci sequence.
void fib(int n){
// l and r inital fibonacci values for n=1 and n=2;
int l=1,r=1,c;
//if n==1 or n==2 then print 1.
if(n==1 || n==2){
cout << 1;
return;
}
//for loop runs n-2 times and calculates nth integer of fibonacci sequence.
for(int i=0;i<n-2;i++){
c=l+r;
l=r;
r=c;
cout << "(" << i << "," << c << ") ";
}
//prints nth integer of the fibonacci sequence stored in c.
cout << "\n" << c;
}
int main(){
int n; //declared variable n
cin >> n; //inputs n to find nth integer of the fibonacci sequence.
fib(n);//calls function fib to calculate and print fibonacci number.
}
PROBLEM 2 IN PYTHON:
def fib(n):
print("fib({})".format(n), end=' ')
if n <= 1:
return n
else:
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
n = int(input())
result = fib(n)
print()
print(result)
Answer:
(a) 561.12 W/ m² (b) 196.39 MW
Explanation:
Solution
(a) Determine the energy and power of the wave per unit area
The energy per unit are of the wave is defined as:
E = 1 /16ρgH²
= 1/16 * 1025 kg/ m3* 9.81 m/s² * (2.5 m )²
=3927. 83 J/m²
Thus,
The power of the wave per unit area is,
P = E/ t
= 3927. 83 J/m² / 7 s = 561.12 W/ m²
(b) The average and work power output of a wave power plant
W = E * л * A
= 3927. 83 J/m² * 0.35 * 1 *10^6 m²
= 1374.74 MJ
Then,
The power produced by the wave for one km²
P = P * л * A
= 5612.12 W/m² * 0.35 * 1* 10^6 m²
=196.39 MW
Answer:
a) 4 passes are required to sort the string.
b) 4
c) i) TARP
ii) CHIP
iii) PART
iv) TARP
v) TARP
d) O(k+n), n is no. of strings, k is largest no. of character in among the string
O(d*(n+10)), n is no. of integers
Explanation:
Answer:
Personal computers:
Personal computers may be useful and lead to productivity as using a computer an employee familiars with is a good thing. However, the disadvantages in some facilities especially ones dealing with customer and information security can include data theft, unauthorized data sharing, uses of internet connection for personal purposes, as this can slow down internet connection at the facility, distraction at work place etc.
Hard drive:
Due to large amount of data that can be stored on a hard drive, it might not be allowed in some facilities to avoid data theft and unauthorized transfer.
Music players:
This might be restricted to avoid distraction at work. Noice in places such as libraries would cause abnormality and poor service delivery. An employee with loud speaker at work would not only distracts himself but also other staffs and customers.
PSP Game Device and other game devices:
Playing games during working hour may jeopardize the productivity and therefore might be resctrited in some facilities and working places.
Electronic digital notepad:
Carrying a handheld electronic digital notepad to the work place can cause lack of concentration and division of attention on work and other personal activities. These can harm working harmony and business productivity.
Video recorder:
In some facilities, this device might not be allowed due to facility privacy and protection from unwanted navigation.
Explanation:
Answer:
Rocks
Explanation:
I am not sure tho bc they are made out of coal and I think coal is a kind of rock