# Keyword

Result: 12 questions

What will be the output of the program?

``````public class SqrtExample
{
public static void main(String [] args)
{
double value = -9.0;
System.out.println( Math.sqrt(value));
}
}``````

What will be the output of the program?

System.out.println(Math.sqrt(-4D));

Which header statement is missing in the given below program to get the desired output?

``````#include<stdio.h>
#include<math.h>

int main ()
{
double x = 1234321;

double result = sqrt(x);

printf("The square root of %.2lf is %.2lf\n", x, result);
return 0;
}``````

What will be the output of the program?

``````#include<stdio.h>
#include<math.h>
int main()
{
printf("%f\n", sqrt(36.0));
return 0;
}``````

What output will be produced by the code below?

``````import Foundation
let number = 16
print("\(number) squared is \(number * number), and its square root is \(sqrt(number))")``````

Answer: This code will not compile.

Explanation: The `sqrt()` function can be called using two different types of parameter, neither of which are integers. In this example, Swift's type inference will consider `number` to be an `Integer`, which cannot be used by `sqrt()`unless you typecast it.

What output will be produced by the code below?

``````import Foundation
let number = 16.0
print("\(number) squared is \(number * number), and its square root is \(sqrt(number))")``````

Correct answer: "16.0 squared is 256.0, and its square root is 4.0".

Explanation: Using its type inference, Swift will consider `number` to be an `Double`, which will be interpolated correctly into the string even when `sqrt()` is called. When `Doubles` are interpolated into strings, they have .0 appended to their values when they have no fractional digits.

What output will be produced by the code below?

``````import Foundation
let number = 16.0
print("\(number) squared is \(number * number), and its square root is \(sqrt(number))")``````

Correct answer: "16.0 squared is 256.0, and its square root is 4.0".

Explanation: Using its type inference, Swift will consider `number` to be an `Double`, which will be interpolated correctly into the string even when `sqrt()` is called. When `Doubles` are interpolated into strings, they have .0 appended to their values when they have no fractional digits.

What would be the output of the following code ?

``> sqrt(-17)``

``for(j=63 , i < 95 , i +=3) x += sqrt(j);``

What output will be produced by the code below?

``````import Foundation
let number = 16
print("\(number) squared is \(number * number), and its square root is \(sqrt(number))")``````

What output will be produced by the code below?

``````import Foundation
let number = 16.0
print("\(number) squared is \(number * number), and its square root is \(sqrt(number))")``````

Explain few useful functions in Excel.