CS202 Exam

Share Embed Donate


Short Description

Computer Programming 2...

Description

Quiz#1 JVM is responsible for Select one: a. Compiling source code b. Interpreting bytecode Correct c. None of the Above d. Reading bytecode e. Generating bytecode

The feature of Java which makes it possible to execute several tasks simultaneously. Select one: a. Code Security b. Multithreaded Correct c. None of the Above d. Robust e. Platform independent

The Java feature, "write once, run anywhere", is termed as Select one: a. High Performance b. None of the Above c. Object Oriented d. Platform independent Correct e. Robust

What did java generates after compiling the java source code? Select one: a. Image file b. None of the Above c. Byte Code Correct d. Executable file e. Class Code Which of the following we are not allowed to write java source code? Select one: a. Notepad b. BlueJ c. NetBeans d. eclipse e. None of the Above Correct

What is the extension name of a Java Source code? Select one: a. javac b. j c. java Correct d. class e. None of the Above

What is the input for Java Compiler? Select one: a. None of the Above b. Code c. Native Code d. Source Code Correct e. Byte Code

Which of the following is not the feature of java? Select one: a. Code Security b. Robust c. Platform independent d. None of the Above e. Static Correct When was the officially released of Java? Select one: a. 1996 b. None of the Above c. 1992 d. 1995 Correct e. 1991

What was the initial name for the Java programming language? Select one: a. NetBeans b. C c. Java d. Oak Correct e. None of the Above

Quiz#2 Can we directly compile codes from NetBeans? Select one: a. No, we can only write codes in NetBeans b. Both A and C are correct. c. Yes, because we can call Java compiler from NetBeans Correct d. It depends, if there is a compiler embedded in NetBeans. Which of the following is true about Runtime errors: Select one: a. Runtime errors occur when there is a design flaw in your program b. Runtime errors occur after compilation. c. Runtime errors occur during run-time. Correct d. All of the above. e. None of the Above

Can we directly compile codes from notepad? Select one: a. Yes, Because we can call Java compiler from notepad b. No, W e can only write codes in Notepad Correct c. Both A and C are correct. d. It depends, if there is a compiler embedded in Notepad. Which of the following we are not allowed to write java source code? Select one: a. None of the Above Correct b. NetBeans c. BlueJ d. Notepad e. eclipse

What will happen if we compile the statement below? ~System.out.println(“Hello W orld!”) Select one: a. There will be a runtime error after compilation. b. There will be no error after compilation. c. There will be a logical error after compilation. d. There will be a syntax error after compilation. Correct e. None of the Above

What is the correct statement to run Java program in command line? Select one: a. javac HelloW orld b. java HelloW orld.java c. None of the Above d. javac HelloW orld.java e. java HelloWorld Correct

What is the correct statement to compile Java program in command line? Select one: a. java HelloW orld b. javac HelloWorld.java Correct c. java HelloW orld.java d. javac HelloW orld Which of the following is true about syntax errors: Select one: a. You will have syntax errors if you misspell the Java command. b. Incorrect capitalization leads to syntax error. c. Syntax errors are usually typing errors. d. All of the above. Correct e. None of the Above

Why do we need to set the path for JavaC in command line? Select one: a. It is part of the compilation process b. To make JavaC available or accessible in command line. Correct c. To resolve runtime error d. None of the Above e. To resolve syntax error

What is the correct statement to set JavaC path in command line? Select one: a. set path b. C:\Program Files\Java\jdk1.6.0_23\bin Correct c. set path d. e. None of the Above f. path C:\Program Files\Java\jdk1.6.0_23\bin g. All of the above

Quiz# 3 Which of the following is not a primitive data type? Select one: a. short b. long c. byte d. none of the above e. String Correct

Which of the following is not a java keyword? Select one: a. name Correct b. None of the above c. goto d. else e. if Which of the following is not a Java comment? Select one: a. None of the above b. Documentation Comments c. Declaration Comments Correct d. Single Line Comments e. Multi-Line Comments

Which of the following is not a valid Float value? Select one: a. 3.4028235E+38F b. none of the above Correct c. 1.2345E+3 d. 1.23 e. 12345678910F

Which of the following is not a valid variable declaration in Java? Select one: a. int x b. float x c. short x; d. int x; e. 1; Correct f. None of the above g. 2.0D;

Which of the following is not Java Literal? Select one: a. None of the above Correct b. Integer value c. Boolean value d. Character value e. Float value Which of the following a valid Java identifier? Select one: a. all of the above b. _id c. id d. $id e. id_1 Correct

Which of the following is not an escape sequence? Select one: a. \t b. \b c. \f d. none of the above Correct

Which of the following is a valid identifier? Select one: a. static b. public c. true d. None of the above e. name Correct

What is floating-point literal? Select one: a. By default it is double type. b. It could be double or float value. c. All of the above Correct d. An integer literal with decimal point. e. Can be express in scientific notation.

Quiz # 5 Which of the following is a valid statement to accept String input? Select one: a. None of the above b. string str = scan.nextShort(); c. String num = scan.nextText(); d. String str = JOptionPane.showInputDialog(""); Correct e. String str = scan.nextString();

Which of the following is a valid nextByte() return value? Select one: a. short value b. int value c. 3 Correct d. None of the above e. 128

Which of the following is a valid statement to accept int input? Let us assume that we have declared scan as Scanner. Select one: a. None of the above Correct b. short num = scan.nextInt(); c. short num = scan.nextShort(); d. int num = scan.getInt(); e. int num = scan.nextLong();

What type of value does the nextLine() returns? Select one: a. double b. String Correct c. long d. Line e. None of the above What will happen if you use JOptionPane.showMessageDialog statement in your program? Select one: a. The program will display an input dialog box that allows the user to input text and returns String value. b. The program will display message dialog box. Correct c. None of the above d. The program will display message dialog box returns String value. e. The program will display an input dialog box that allows the user to input text and returns the correct type value.

Which of the following method reads input from the user and return String value? Select one: a. All of the above b. nextValue() c. nextText() d. nextLine() Correct e. nextString()

Which of the following is a valid nextInt() return value? Select one: a. 1010 Correct b. None of the above c. long value d. 3.1416 e. floating-point literal

Which of the following does not return numeric value? Select one: a. nextDouble() b. nextLong() c. nextShort() d. None of the above Correct e. nextInt() What will happen if you use JOptionPane. showInputDialog statement in your program? Select one: a. The program will display message dialog box returns String value. b. The program will display an input dialog box that allows the user to input text and returns the correct type value. c. The program will display message dialog box. d. The program will display an input dialog box that allows the user to input text and returns String value. Correct e. None of the above Which of the following is a valid nexDouble() return value? Select one: a. All of the above Correct b. 12.0 c. double value d. floating-point literal e. 3.1416

Quiz # 6 What will be the output if you execute this code? do{System.out.println("Hello W orld!");}while(false); Select one: a. print "Hello W orld" infinitely b. Do nothing c. None of the above. d. The code will not run because of syntax error e. print "Hello World" Correct

Which is not a decision control structure? Select one: a. switch b. if c. if else d. if else-if else e. None of the above Correct

What will be the value of x after you execute this statement int z=0; for(int x=0; xy) e. if (x!y) d. if (x=0; x--){System.out.print(intArray[x]);} Select one: a. 12356 b. none of the choices c. The given code is not valid d. 123567 e. 765321 Correct

What is the output of the code snippet below: int[] intArray = new int[10]; for(int x = 0; x
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF