Answer:
The program to this question can be given as:
Program:
def swap_values(user_val1, user_val2): #define function
return (user_val2, user_val1) #return values
if __name__ == '__main__': #define constructor.
n1 = int(input('Enter first number :')) #input value form user
n2 = int(input('Enter second number :')) #input value form user
(n1,n2) = swap_values(n1,n2) #hold function values.
print(n1) #print values
print(n2) #print values
Output:
Enter first number :3
Enter second number :8
8
3
Explanation:
The explanation of the above python program can be given as:
- In the python program we define a function that is "swap_values". This function takes two integer values that is "user_val1 and user_val2" as a parameters and returns variable values that is "user_val2 and user_val1".
- Then we use a constructor in this we define two variable that is "n1 and n2" these variable are use to take user-input from the user and pass the value into the function.
- To hold the value of the function we use n1 and n2 variable and print these variable value.
Answer:
a) Speedup gain is 1.428 times.
b) Speedup gain is 1.81 times.
Explanation:
in order to calculate the speedup again of an application that has a 60 percent parallel component using Anklahls Law is speedup which state that:

Where S is the portion of the application that must be performed serially, and N is the number of processing cores.
(a) For N = 2 processing cores, and a 60%, then S = 40% or 0.4
Thus, the speedup is:

Speedup gain is 1.428 times.
(b) For N = 4 processing cores and a 60%, then S = 40% or 0.4
Thus, the speedup is:

Speedup gain is 1.81 times.
Answer:
A game is built from a combination of sub-tasks in order to provide the best experience to the user and make sure that the interface is comprises of only the results of the ongoing sub-tasks to provide a higher degree of data abstraction.
Data abstraction refers to the process of representing the essential information without including the background details. Rolling a dice is preferred to be a sub-task so that the user only gets to know about the result of the roll and does not have to wait for or anticipate the result. Moreover, a game may consist of n number of sub-tasks so it is not a good idea to include them in the main framework and are preferred to be abstracted.
Solution :
#include<
>
#include<conio.h>
void dec_bin(int number) {
;
x = y = 0;
for(y = 15; y >= 0; y--) {
x = number / (1 << y);
number = number - x * (1 << y);
printf("%d", x);
}
printf("\n");
}
int main()
{
int k;
printf("Enter No u wanted to right shift by 4 : ");
scanf("%d",&k);
dec_bin(k);
k = k>>4; // right shift here.
dec_bin(k);
getch();
return 0;
}