0

programming languages Online Quiz - 207

Description: programming languages Online Quiz - 207
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

What's the difference between an Applet and an application ?

  1. An application is only available on Windows

  2. Applets can paint words, applications cannot.

  3. Applets are run over the web.

  4. None of the above.


Correct Option: C

What is the main function of any variable ?

  1. To add numbers together

  2. To keep track of data in the memory of the computer

  3. To print words on the screen

  4. To write Java


Correct Option: B
  1. variableName variableType;

  2. variableName;

  3. variableType;

  4. variableType variableName;


Correct Option: D

Booleans are _______.

  1. True or False

  2. Single characters

  3. Text

  4. All numbers


Correct Option: A

What is an assignment statement ?

  1. Adding a number to an int

  2. Assigning a multiplication

  3. Assigning a name to a variable

  4. Assigning a value to a variable


Correct Option: D

What will be the value of “num” after the following statements? int num; num = (5+4); num = num / 9; num = 12;

  1. 0

  2. 1

  3. 12

  4. 9


Correct Option: C

Which of the following means that in order for the conditional to happen, either x must be less than 3 or y must be greater than or equal to 4 ?

  1. if ((x < 3) && (y > 4))

  2. if (x < 3 y >= 4)

  3. if ((x < 3) || (y > = 4))

  4. if ((x > 3) || (y < = 4))


Correct Option: C
  1. A new type of Applet

  2. A segment of code to be run a specified amount of times

  3. A segment of code to be run infinite times

  4. A segment of code to be run once


Correct Option: B

What is essential in making sure that your loop is not infinite ?

  1. That there is a Boolean statement somewhere in your code

  2. That your Boolean statement will at some point be false

  3. That your Boolean statement will at some point be true

  4. All of the above


Correct Option: B

Which is NOT a section of all types of loops ?

  1. Initialization

  2. Loop Body

  3. Test statement

  4. The word "while"


Correct Option: D
  1. A group of code lines that performs a specific task

  2. A group of code lines that performs a whole program

  3. Something that contains an ‘init’

  4. The purpose of Java


Correct Option: A
  1. Public functions are free, you have to buy private ones

  2. Public functions are the only ones you can download

  3. Public functions can be used by anyone, private can only be used by other code in the class you are writing

  4. Public functions can’t be used


Correct Option: C
  1. Advanced Window Toolkit

  2. Abstract window Toolkit

  3. Adjust Window Toolkit

  4. None of these


Correct Option: B

Given: class Hexy { public static void main(String[] args) { Integer i = 42; String s = (i<40)?"life":(i>50)?"universe":"everything"; System.out.println(s); } } What is the result?

  1. null

  2. life

  3. universe

  4. everything

  5. Compilation fails

  6. An exception is thrown at runtime


Correct Option: D

Given: class Titanic { public static void main(String[] args) { Boolean bl = true; boolean b2 = false; boolean b3 = true; if((bl & b2) | (b2 & b3) & b3) System.out.print("alpha "); if((bl = false) | (b1 & b3) | (bl | b2)) System.out.print("beta "}; } } What is the result?

  1. beta

  2. alpha

  3. alpha beta

  4. Compilation fails

  5. No output is produced

  6. An exception is thrown at runtime


Correct Option: E
- Hide questions