In python, the sort() function will alphabetically sort a list of strings
Answer:
a. 100%
b. 50%
c. 66.6%
Explanation:
a.
The memory references D6, 58, D8, 9A, DE and 5C all results in misses and the miss ratio is 100 (that is , 6 misses/ 6 references*100 = 100%)
b.
If fully associative cache is used, there will be a 3 cache misses with miss ratio of (3/6*100) = 50%.
c.
With a 2-way set-associative cache, 4 memory reference misses will occur, with a miss ratio of (4/6*100)= 66.6% misses.
Answer:
red
Explanation:
public class CarTest {
public static void main(String[] argvs) {
//below line will create an object of CarTest class Object
CarTest carTest = new CarTest();
//This will call runDemo method
carTest.runDemo();
}
public void runDemo() {
//Below line will create an object of Car class with color blue and 4 wheel
Car c = new Car("blue", 4);
//Bellow Line will change the color from blue to red, see the logic writteen in chnageColor method definition
changeColor(c, "red");
//Below line will print the color as red
System.out.println(c.getColor());
}
public void changeColor(Car car, String newColor) {
//This line will set the color as passed color in the car object
car.setColor(newColor);
}
}
Answer:
The code for the function is given below in Python language
Explanation:
def append_string_to_file(filename, text):// function takes the filename // and text to append
f = open(filename, 'a')
f.write(text) //function part that writes the text
f.close() //closing the file using the explicit close function