Double

Practice Questions

Computer Science › Double

Questions
5
1

What line number makes the following Python Code not execute? (1:, 2:, 3:,... represents line numbers)

1: x=\[\]

2: y=\[\]

3: z=\[\]

4: for i in range(10):

5: x.append(i)

6: y.append(x\[i\]+2*x\[i\])

7: z.append(x\[i\]+y\[i\]**2)

8: print(z)

9: string="The fourth element of z is "+z\[3\]

10: print(string)

2

Consider the following code:

double a = 4.5, d = 4;

int b = 10,c=5;

double e = a / b + c / d - d % c;

What is the value of e at the end of this code's execution?

3

How do we declare a method to return a Double in Swift (iOS)?

4

What is the size of the float data type in Java?

5

Breanna wants to keep track of how many grapes she eats in a day over the course of a week.

Her brother Nathan, however, wants to keep track of the average amount of grapes he eats in a day over the course of a week.

What type of variable would best be fit for what Breanna wants to keep track of? What about Nathan?

Return to subject