Answer:
The code to this question can be given as:
Code:
while ((s!="Y" && s!="y" && s!="N" && s!="n")) //loop for check condition
{
cin >> s; //insert value
}
Explanation:
The description of the following code:
- In this code, we use a string variable s that has been to define in question.
- In code, we use a while loop. It is an entry control loop in loop we check variable s value is not equal to "y", "Y", "n" and "N".
- In the loop we use AND operator that checks all value together. If this is true So, we insert value-form user input in string variable that is "s".
I would recommend A. Quickly on the left and move ahead of it because you should always pass on the left and seeing as it is a large truck, you would want to get ahead of it ASAP.
Answer:
<u>Call by reference</u>
In an function if the variables are passed as reference variables this means that the variables are pointing to the original arguments.So the changes made in the function on the reference variables will be reflected back on the original arguments.
For example:-
#include<stdio.h>
void swap(&int f,&int s)
{
int t=f;
f=s;
s =temp;
}
int main()
{
int n,m;
n=45;
m=85;
swap(n,m);
printf("%d %d",m,n);
return 0;
}
the values of m and n will get swapped.
<u>
Call by value</u>
In this program the values of m and n will not get swapped because they are passed by value.So duplicate copies of m and n will be created and manipulation will be done on them.
#include<stdio.h>
void swapv(int f,int s)
{
int t=f;
f=s;
s=temp;
}
int main()
{
int n,m;
n=45;
m=85;
swapv(n,m);
printf("%d %d",n,m);
return 0;
}
Answer:
Explanation:
Operation Address Hit? Read Value
Read 0x834 No Unknown
Write 0x836 Yes (not applicable)
Read 0xFFD Yes CO
Answer:
See Explaination
Explanation:
def listmax(lst):
largest = None
for num in lst:
if largest is None or num > largest:
largest = num
return largest
mylist = [10, 20, 30]
x = listmax(mylist)
print(x)