Page 1 of 1

NOTE: I need only the output. Please give both the answers. Thanks for your help. 7. Read the following code snippet: st

Posted: Fri Jul 01, 2022 5:34 am
by answerhappygod
NOTE: I need only the output. Please give both theanswers. Thanks for your help.
7. Read the following code snippet:
string s = ".NETCore"; char[] arr = s.ToCharArray();
Stack<char>stack = new Stack<char>(); foreach(char c in arr) {
stack.Push(c);
}
for(int i = 0; i< arr.Length; i++) { arr = stack.Pop();
}
s = newString(arr); Console.WriteLine(s);
The output will be:
8. Read the following code snippet:
public staticdouble Double(double value) { return 2 * value;
}
public staticdouble Square(double value) { return value * value;
}
public static voidTest() { List<Func<double, double>> list =
newList<Func<double, double>>() { Double, Square };Process(list, 16);
}
private static voidProcess(List<Func<double,double>> funcs, double value){
double result;
foreach(var actionin funcs) { result = action(value); Console.Write(
$"{action.Method.Name}({value}) ={result}. ");
}
}
The output will be: