Answer:
abstract class Mark //Creating an Abstract class{
abstract double getPercentage();}
class A extends Mark{
double result;
A( int val1, int val2, int val3){
result=(val1+val2+val3)/3;}
double getPercentage(){
return result;}}
class B extends Mark{
double result;
B(int val1, int val2, int val3, int val4){
result=(val1+val2+val3+val4)/4;}
double getPercentage(){
return result;}}
class Main{
public static void main(String args[]){
//class A Object
Mark obj_1=new A(10,20,30);
System.out.println(obj_1.getPercentage());
//class B Object
Mark obj_2=new B(10,20,38,46);
System.out.println(obj_2.getPercentage());}}
Answer:
Operating system
Explanation:
An interrupt is the signal sent to the processor that interrupts the current process. It may be generated by a hardware device or a software program.With each interrupt the CPU hardware does exactly the same thing, which is what enables operating systems to take control of the current user operation.
Answer:
Explanation:
The following code is written in Python. It creates a method for each one of the questions asked and then tests all three with the same test case which can be seen in the picture attached below.
def alternating_list(lst1, lst2):
lst3 = []
for x in range(len(lst1)):
lst3.append(lst1[x])
try:
lst3.append(lst2[x])
except:
pass
if len(lst2) > len(lst1):
lst3.extend(lst2[len(lst1):])
return lst3
def reverse_alternating(lst1, lst2):
lst3 = []
if len(lst1) == len(lst2):
for x in range(len(lst1) - 1, -1, -1):
lst3.append(lst1[x])
lst3.append(lst2[x])
return lst3
def alternating_list_no_extra(lst1, lst2):
lst3 = []
max = 0
if len(lst1) > len(lst2):
max = len(lst2)
else:
max = len(lst1)
for x in range(max):
lst3.append(lst1[x])
try:
lst3.append(lst2[x])
except:
pass
return lst3