Coding
Math
100

What does the following code return?

String club = "AI @ UNCP";

String response = "Hello " + club;

return response;

Hello AI @ UNCP

100

If an AI model incorrectly classifies 30 percent of dogs objects as cats, how many cats would be predicted by the model if you feed nothing but 200 dog objects into it?

60 (200*.3)

200

What does the following Java Code Print to the console?


int a = 5;

int b = 10;

System.out.print(a+b);

15

200

If Steve Jobs is worth $1 million, Elon Musk is worth 5 times Steve Jobs net worth, and Andrew is worth 1% of Elon Musks net worth, how much is Andrew's net worth?

$50,000 ($1 million * 5 = $5 million *.01 = $50000)

300

Does the following code return Elon Musk or Bill Gates?

String Person1 = "Elon Musk"

String Person2 = "Bill Gates"

if(Person1.charat(6) == Person2.charat(6)){

return Person1;

}

else{

return Person2;

}

Bill Gates

300

A linear regression model for the predicted stock price of Google is Y=2X+5, where X=the Current Period Net Income. If the current period net income is $10, what would the predicted stock price be?

$25 (10*2+5)

400

In the following Java code, what is printed to the console?

int i = 20;

while(i>3){

i /= 2;

}

System.out.print(i);

2

20/2 = 10

10/2 = 5

5/2 = 2(since an integer)

-Stops while loop since not greater than 3 and gets printed to console

400

You’re playing a game where you roll two fair six-sided dice. You win if the sum is 7 or 11. If you roll a 7, you get $10; if you roll an 11, you get $20. Otherwise, you lose $5. Calculate the expected value of a single round of this game. Should you play?

$-1.67 

It's the weighted average of the liklihood of each value occuring multiplied by the amount won or loss by each value

((.083*10)+(.083*20)-(.083*5*50) = -1.67

500

What does the following code return?

String name = "John";

int counter = 0;

for(int i = 0; i< name.length(); i++){

counter++;

}

if(counter ==5){

return "Pancake"

}

else{return "Marshmellow"}

Marshmellow since the counter variable is 5 by the time it gets to the if statement

500

In a game where one person picks a number between 1 and 100, and the other person gets 4 attempts to guess this number, where on each incorrect attempt the guessor will be informed if the real number is greater than or less than the picked number, what is the maximum probability that the guessor will choose the correct number in  those 4 attempts?

15%

Using a Binary Search Algorithem:

1st Attempt     1%

2nd Attempt    2%

3rd Attempt     4%

Fourth Attempt 8%

M
e
n
u