Answer:
The answer to this question can be described as follows:
binary address: 01001, 01100, 01111.
Cache block: 1, 4, 7
Explanation:
Given values
Memory = 5 bit and cache = 8 blocks
Option 1)
memory location is =9
convert into binary number, so we get binary address = 01001
So, the cache block = 1
Option 2)
memory location is = 12
convert into binary number, so we get binary address = 01100
So, the cache block = 4
Option 3)
memory location is =15
convert into binary number, so we get binary address = 01111
So, the cache block = 7
Traceback (most recent call last):
File " ", line 1, in
9/0
ZeroDivisionError: division by zero
Answer choices:
reserved word error
logical error
exception
syntax error
Answer: Logical Error
The division by 0 is a logical error.
b) onto but not one-to-one
c) neither one-to-one nor onto
Answer:
Let f be a function
a) f(n) = n²
b) f(n) = n/2
c) f(n) = 0
Explanation:
a) f(n) = n²
This function is one-to-one function because the square of two different or distinct natural numbers cannot be equal.
Let a and b are two elements both belong to N i.e. a ∈ N and b ∈ N. Then:
f(a) = f(b) ⇒ a² = b² ⇒ a = b
The function f(n)= n² is not an onto function because not every natural number is a square of a natural number. This means that there is no other natural number that can be squared to result in that natural number. For example 2 is a natural numbers but not a perfect square and also 24 is a natural number but not a perfect square.
b) f(n) = n/2
The above function example is an onto function because every natural number, lets say n is a natural number that belongs to N, is the image of 2n. For example:
f(2n) = [2n/2] = n
The above function is not one-to-one function because there are certain different natural numbers that have the same value or image. For example:
When the value of n=1, then
n/2 = [1/2] = [0.5] = 1
When the value of n=2 then
n/2 = [2/2] = [1] = 1
c) f(n) = 0
The above function is neither one-to-one nor onto. In order to depict that a function is not one-to-one there should be two elements in N having same image and the above example is not one to one because every integer has the same image. The above function example is also not an onto function because every positive integer is not an image of any natural number.
Answer:
Scope creep is defined as the uncontrolled changes occur in the projects scope is known as scope creep. It basically occur when the project scope are not properly define and controlled.
Suggestions for preventing scope creep in projects are as follow:
public class Test {
public static void main(String[] args) {
A a = new A();
System.out.println(a.getValue());
}
class B {
public String getValue() {
return "Any object";
}
class A extends B {
public Object getValue() {
return "A string";
}
2.
public class Test {
public static void main(String[] args) {
A a = new A();
System.out.println(a.getValue());
}
class B {
public Object getValue() {
return "Any object";
}
class A extends B {
public String getValue() {
return "A string";
}
a.I
b.II
c.Both I and II
d.Neither
Answer:
Hi there KatiesTomato! The answer is: b. II
Explanation:
Java allows us to override a method defined in the main or Parent class by re-defining it in the child class. In the question, the first option gives us code that will throw an error because the String method getValue() in class B is being overridden by a method in class A which returns an Object which is also a String. So the compiler will throw an error that type Object is not compatible with String. Option 2 will compile successfully and return a String because the Object is allowed to be converted to a String.
Answer:
The constructor are executed when the constructor object are comes in the existence as per the general rule in the computer programming language. The constructor is the special type of the class function that basically perform the initialization of the each object in the computer science.
Then, the constructor initialized actual value of the member of an object are allocated to the given object in the system.