Looking for Процедурне програмування (кіббез) test answers and solutions? Browse our comprehensive collection of verified answers for Процедурне програмування (кіббез) at distedu.ukma.edu.ua.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Given the following code:
int g (int x, int y) {
switch(x - y) {
case 0:
return x;
case 4:
y = y + 1;
break;
case 7:
x = x - 1;
case 9:
return x*y;
case 3:
y = x + 9;
default:
return y - x;
}
return y;
}
What is the output for g(3, 0)?
What is the time and space complexity of this function?
int g(int arr[], int n, int target) {
int low = 0, high = n - 1;
while (low <= high) {
int mid = (low + high) / 2;
if (arr[mid] == target) {
return mid;
} else if (arr[mid] < target) {
low = mid + 1;
} else {
high = mid - 1;
}
}
return -1;
}
What is the range for the short type if it consists of 16 bits?
Consider the following operation that overflows:
unsigned char c = 3;
c -= 5;
What value does c have after the above statements are executed? (Give your answer as a decimal integer.)
Consider the following code:int f(int num, int bit) {
int mask = ~(1 << bit); return num & mask;
}
What is the result of the function f(5,2)?
In IEEE 754 single-precision floating-point representation, how many bits are allocated for the mantissa and the exponent?
What is a function prototype?
What is the default initialization value of a global variable in C if no explicit initializer is provided?
What is the largest numerical value that can be represented by a signed char? (Give your answer as a decimal integer.).
Consider the following program:
int a = -1;
int b = a * 5.4;
printf("%d %.3f\n", a, (float)b);
Write the program output.