Home / MCQ Bank / Computer
Computer Array Difficulty: Medium

Determine output: public class Test{ public static void main(String[] args){ int[] x = {1, 2, 3, 4}; int[] y = x; x = new int[2]; for(int i = 0; i < x.length; i++) System.out.print(y[i] + " "); } }

Select the correct option to test your answer:

More Computer Questions

What will be the output of the following C code? #include <stdio.h> int main() { int a = 1, b = 1, d = 1; printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++); } ROM is needed for storing an initial program called _______. Following combination of keys is used to maximize or restore a selected window: What will be the output of the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> v; for (int i = 1; i <= 5; i++) v.push_back(i); v.resize(4); for (auto it = v.begin(); it != v.end(); it++) cout << *it << " "; return 0; } What will be the output of the following C function when EOF returns? int fputs(char *line, FILE *fp)