Answer:
{"double", "char", "char", "double"} will be stored in word.
Explanation:
Given the word is an array of four strings, {"algorithm", "boolean", "char", "double"}. Hence, the length of the word array is 4.
The for-loop will only run for two iterations due to i < word.length/2, with i = 0 (first loop) and i = 1 (second loop).
In the first loop,
- word[word.length - 1 - i] = word[4 - 1 - 0] = word[3] = "double"
- Hence, the string "double" will be assigned to word[0] and overwrite "algorithm"
In the second loop,
- word[word.length - 1 - i] = word[4 - 1 - 1] = word[2] = "char"
- Hence, the string "char" will be assigned to word[1] and overwrite "boolean"
At last, the word array will hold {"double", "char", "char", "double"}
Answer:
Check the explanation
Explanation:
% iterate through each column (outer loop) , then iterate rows-1 (inner loop)
%take product of adjacent rows
mat = input('enter 5 by 5 matrix : ');
[R,C] = size(mat);
max_prod =0;
for c =[1:C]
for r=[1:(R-1)]
temp = mat(r,c)*mat((r+1),c);
if max_prod<temp
max_prod=temp;
end
end
end
fprintf('Greatest product : %i\n', max_prod)
Kindly check the output in the attached image below.
Answer:
d. A safer path is to wait for an official release and to avoid using a beta system in a production environment.
Explanation:
Beta version: This is a pre-release of software that is given out to a large group of users to try under genuine conditions. Beta versions have gone through alpha testing inhouse and are generally fairly close in look, feel and function to the final product; however, design changes often occur as a result.
Answer:
Check the explanation
Explanation:
relatives.pl
/* Facts */
male(ace).
male(john).
male(jack).
male(bill).
male(david).
male(brown).
male(daniel).
female(cecil).
female(aba).
female(cathy).
parent(john,ace)
parent(tom,john)
parent(jack,john)
parent(bill,aba)
parent(brown,aba)
parent(cecil,bill)
parent(david,cecil)
parent(cathy,brown)
parent(daniel,cathy)
parent(ellen,daniel)
/* parent(X,Y) -> Y is parent of X */
wife(ceceil,jack) /* wife(X,Y) -> Y is wife of X */
Answer of 2-2
Considering all facts and rules answer will be daniel,ellen.
Answer 2-3
Considering all facts and rules answer will be bill.
Answer 2-4
Considering all facts and rules X will be john and y will be cecil.
Answer 2-5
Considering all facts and rules X will be tom and y will be david.
Native Code Or Machine Language