Тести
Мова сайту: Українська
Українська
English
Русский
Тести з програмування
Вхід
Реєстрація
Тести з програмування
Теорія
Сніпети
Статті
Головна
Android
Ціни
FAQ
Історія Cosmo
Правила та умови сервісу
Політика конфіденційності
Політика щодо файлів cookie
Зворотній Зв’язок
loops
:
Мова контенту: English
Русский
What will happen when you try to compile and run the following code? It is assumed that the outstream file is already created. import java.io.*; public class Main { public static void main(String[] args) { try { FileInputStream fis = new FileInputStream("outstream"); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); try { do { String str = br.readLine(); System.out.println(str); } while (str != null); } finally { fis.close(); isr.close(); br.close(); } } catch(IOException e){ e.printStackTrace(); } } }
loops
What will be the result of the following program execution? public class Test { static boolean foo(char c) { System.out.print(c); return true; } public static void main(String[] args) { int i = 0; for ( foo('A'); foo('B') && (i < 2); foo('C')) { i++; foo('D'); } } }
loops
What is the result of the following code compilation and execution? public class A { public static void main(String[] args) { for (int i = 0; ++i > 0;) { System.out.println(i); } } }
loops
Given a two-dimensional array (matrix) int[][] arr = {{1,2,3}, {0,0,0}, {3,2,1}}; Which of the answer choices allow to iterate over all the elements of an array and display them on the screen by means of for-each statement?
loops
What will be the result of the following code execution? for(int i = 0 ; i < 4 ; ) { switch(new Integer(i++)) { case 1: System.out.print("one "); break; case 3: System.out.print("three "); case 4: System.out.print("four "); default: System.out.print("def "); } }
loops
What will be printed out as a result of the following code execution? public class TheLoop { public static void main(String...args) { int i = 1; do while(i < 1) System.out.println("i = " + ++i); while (i > 1); } }
loops
What will the following code print out? 01: public class MainClass { 02: public static void main(String[] arg) { 03: int limit = 10; 04: int sum = 0; 05: 06: int i = 1; 07: for (; i <= limit;) { 08: sum += i++; 09: } 10: System.out.println(sum); 11: } 12: }
loops
What happens when the following class is compiled and executed? public class VerySimpleClass { public static void main(String... args) { for (byte i = 6, j = 0 ; (j += i++) <= 10; i >>= 1, System.out.print(--j)); } }
loops
What is the result of the following code compilation and execution? public class Test { public static void main(String[] args) { for (final int i : new int[] { 1, 2, 3 }) { System.out.println(i + 1); } } }
loops
What will be the value of the variable count after executing of this code? int count = 1, i = 0; do { count *= ++i; if (count > 5) break; } while (i <= 4);
loops
← Попередня
1
2
3
Наступна →
Зареєструйся Зараз
або
Підпишись на майбутні тести