Importance of array in Java
Following are some important points about Java arrays. Since arrays are objects in Java, we can find their length using the object property length. Java array can be also be used as a static field, a local variable or a method parameter. The size of an array must be specified by an int or short value and not long.
Answer:
# Code in Python
dictionary={'A':1,'B':2,'C':3,'D':4}
other_dictionary={}
for keys in dictionary:
if dictionary[keys]&1==1:
temp=dictionary[keys]*dictionary[keys]-10*10
other_dictionary[keys]=temp
else:
other_dictionary[keys]=dictionary[keys]
print(other_dictionary)
assert other_dictionary
Explanation:
- Initialize a sample example dictionary and other_dictionary.
- Do a binary comparision for checking odd number
.
- Update the the value stored in the dictionary to store the squared difference of the original value and '10'.
- For even: store the original value (from dictionary).
Answer:
Look Up Value, Table Array, First Column
Explanation:
The VLOOKUP function structure begins with =VLOOKUP(
✔ lookup value
,
✔ table array
…)
To use the VLOOKUP function, the lookup value should be in the
✔ first column
of the table.
Answer:
Check the explantion
Explanation:
a. There is a race condition on the variable number of processes.
b. A call to acquire() must be placed upon incoming each function and a call to release() instantly before exiting each function.
c. No, it wouldn’t help in anyway. The reason being that the race happens in the allocate process() function where the number of processes is first tested in the if statement, yet is updated afterwards, based upon the value of the test. it is possible that number of processes = 254 at the time of the test, yet as a result of the race condition, is set to 255 by another thread before it is incremented yet again.