Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Puzzles

Android Puzzles

These Puzzles were created for Google IO Extended 2018.

Chandra Sekhar Nayak

May 08, 2018
Tweet

More Decks by Chandra Sekhar Nayak

Other Decks in Technology

Transcript

  1. Rules for the Quiz 1. Don’t shout the answer. 2.

    Raise your hand, we will come to you with mic. 3. Who answers first wins. 4. For why questions, answer should be descriptive? Only guessing an option will not be considered as answer. 5. Be a good citizen, one person is eligible to answer only once
  2. Which two options holds good for main() method? 1. The

    method must be public. 2. The method may be any accessibility type except private. 3. The method may be either an instance method or static. 4. The argument list must be declared exactly as String [] args. 5. The argument list may be declared as String… args.
  3. Output of the snippet? List<String> names = Arrays.asList("BlrKotlin", "BlrDroid"); names.add("PhonePe");

    names.add("Google IO"); Log.d("IOExtended", "Names are - " + names); 1. Prints the names 2. Compilation fails 3. Runtime Exception
  4. What it prints? class Main { public static void main(String[]

    args) { System.out.println("IOExtended!"); // \u000d System.out.println("On 8th May"); } }
  5. What’s the output fun main(args: Array<String>) { (1..5).forEach({ i ->

    if (i > 3) return println(i) }) println("Done") }
  6. Android Threading To run a lot of parallel threads, what

    do you need A. AsyncTask B. Handler Thread C. Thread Pool D. Intent Service
  7. What will be the output of following code? public class

    Test { public static void main(String... x) { int[] arr = new int[9]; for (int i = 0; i < arr.length; i++) { arr[i] = i; } System.out.println(arr[9]); } }
  8. Which browser this code opens? class Test { public static

    void main(String... x) { http://www.google.com System.out.println("Hello World"); } } 1. Chrome 2. Default browser on your machine 3. Compile Time Error 4. Runtime Exception 5. Runs fine
  9. What is the output of below code? class Test {

    public static void main(String... x) { StringBuffer buffer = new StringBuffer('H'); buffer.append('i'); System.out.print(buffer); } } 1. Compile Time Error 2. Prints “Hi” 3. Prints “H” 4. Prints “i”