Which of the following is the greatest? \[ 0.6, \ 0.666, \ \frac{5}{6}, \ \frac{2}{3} \]
To compare repeating and terminating decimals, convert them to fractions and compare their values.
0.6
0.666
\( \frac{5}{6} \)
\( \frac{2}{3} \)
Step 1: Convert the decimals to fractions
- 0.6 is equivalent to \( \frac{2}{3} \).
- 0.666 is already a terminating decimal and equals \( \frac{2}{3} \).
- \( \frac{5}{6} \) is in its simplest fractional form.
- \( \frac{2}{3} \) is also in its simplest form.
Step 2: Comparison
- \( 0.6 = \frac{2}{3} \), which is less than 0.666.
- 0.666 is slightly greater than \( \frac{2}{3} \), and is the greatest among the values listed.
Thus, the correct answer is (B).
Consider the following code:
main() {
int x = 126, y = 105;
{
if (x > y)
x = x - y;
else
y = y - x;
}
while (x != y)
printf("%d", x);
}
Consider the following code:
int a;
int arr[] = {30, 50, 10};
int *ptr = arr[10] + 1;
a = *ptr;
(*ptr)++;
ptr = ptr + 1;
printf("%d", a + arr[1] + *ptr);
Consider the following code:
int a;
int arr[] = {30, 50, 10};
int *ptr = arr[10] + 1;
a = *ptr;
(*ptr)++;
ptr = ptr + 1;
printf("%d", a + arr[1] + *ptr);
Consider the following hierarchical cache system with the following access times:
\[ \begin{array}{|c|c|c|} \hline \textbf{Cache Level} & \textbf{Hit Rate} & \textbf{Access Time} \\ \hline L1 & 90\% & 1 \text{ ns} \\ L2 & 80\% & 10 \text{ ns} \\ L3 & 100\% & 100 \text{ ns} \\ \hline \end{array} \]Find \( T_{avg} \) for hierarchical or simultaneous access.
What is the output of the following C code?
void foo(int *p, int x) {
*p = x;
}
void main() {
int *z;
int a = 20, b = 25;
z = a; // Incorrect: Should be z = a;
foo(z, b);
printf("%d", a);
}
Issue: The statement z = a; is invalid because a is an integer, and z is a pointer.