Welcome to Core Java Quiz. Java is an object-oriented programming language. Show Core Java QuizIn this quiz, you will be tested on Core Java basics and OOPS concepts. There are some code snippets too to test your basic Java coding skills. Some of the questions have multiple answers. You can click on the “Reveal Answer” button for the correct answer and explanation. Give it a try and share it with others if you like it. 1. Which of the below is valid way to instantiate an array in java?A. int myArray [] = {1, 3, 5}; Correct Answer: A int [] myArray = {“1”, “2”, “3”}; is invalid because String can’t be converted to an int. int [] myArray = (5, 4, 3); is invalid because array elements should be defined in curly braces ({}). int myArray [] [] = {1,2,3,4}; is invalid because myArray is a two-dimensional array whereas in this case it’s being defined as a one-dimensional array. The compiler will complain as Type mismatch: cannot convert from int to int[]. 2. Which of the below are reserved keyword in Java?A. array **Correct Answer: B, D 3. What will happen if we try to compile and run below program?
A. Prints 10 **Correct Answer: C 4. What will be the output of the below program?
A. Compile Time Error **Correct Answer: B 5. What will be output of below program?
A. Runtime Error Correct Answer: A Runtime error because main method is not static. The error message will be 6. What are the valid statements for |