Answer:
A. 31 bits
B. 13 bits, 18 bits
C. 256k
Explanation:
A.
We have total size of physical memory as 2gb
This means that 2¹ x 2³⁰
Using the law of indices,
= 2³¹
So physical address is equal to 31 bits
B.
We get page size = 8kb = 2³
1 kb = 2¹⁰
2³ * 2¹⁰ = 2¹³
So page replacement = 13 bits
Page frame number
= physical address - replacement bits
= 31 - 13
= 18 bits
C.
The number of frames is given as
2¹⁸ = 2⁸ x 2¹⁰ = 256K
So number of frames = 256K
D
Logical add space is 256K
Page size= physical pages = 8kb
Logical address layout= 28biys
Page number = 15 bits
Displacement = 12 bits
256k/8k = 32 pages in address space process
Answer:
def func1(x):
return (x-32)*(5/9)
def func2(x):
return (x/2.237)
def main():
x = ""
while x != "x":
choice = input("Enter 1 to convert Fahrenheit temperature to Celsius\n"
"Enter 2 to convert speed from miles per hour to meters per second: ")
if choice == "1":
temp = input("please enter temperature in farenheit: ")
print(func1(float(temp))," degrees celcius.")
elif choice == "2":
speed = input("please enter speed in miles per hour: ")
print(func2(float(speed))," meters per second")
else:
print("error... enter value again...")
x = input("enter x to exit, y to continue")
if __name__ == "__main__":
main()
Explanation:
two function are defines func1 for converting temperature from ferenheit to celcius and func2 to convert speed from miles per hour to meters per second.
Answer:
a) public class Bear extends Animal{
...
}
public class Zoo
{ private Animal[] myAnimals;
...
}
Explanation:
The question is an illustration of inheritance in Java programming language.
The syntax to follow is:
class subclass extends superclass {...}
From the question:
Bear subclass
Animal superclass
So, the following declaration will be used:
class Bear extends Animal{
...
}
Also from the question, the zoo object represents collection of many animals.
So, its declaration will follow:
class class-name{ ..... }
i.e.
class zoo{ .... }
The ... can then be replaced with declaration of each animal or an array to represent the declarations..
<em>Hence, (e) is correct</em>
def something(string1, string2):
return True if string2 in string1 else False
This would be the most concise way of writing this function.