Intro to Java

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

// filename Main.java class Main { public static void main(String args[]) { System.out.println(fun()); } int fun() { return 20; } } A. Compiler Error B. 20 C. Code will compile but it won't run D. None of the above

A

// filename Test.java class Test { public static void main(String[] args) { for(int i = 0; 1; i++) { System.out.println("Hello"); break; } } } A. Compiler Error B. Hello C. None D. Code will compile but it will not run

A

Assume that you are given the following declarations: int num = 0; double val = 0.0; num = 10 % 6 / 3 - 1; Show the value that will be stored in the variable on the left. If the expression causes an error, just type error. A. 0 B. Error C. -1 D. 0.3333333

A

What are considered placeholders for values in Java? A. variables B. data types C. classes D. keywords

A

What does the int data type represent? A. integers B. decimal numbers C. doubles D. fractions E. char

A

What would be the output for the following code: String name = "Junali"; System.out.println(name + "is my friend."); A. Junaliis my friend. B. Nothing will be printed due to an error. C. Junali is my friend D. Junali is my friend.

A

Which of the following is a Java keyword? A. class B. variable C. objects D. method

A

Which one of the following is NOT a properly named variable? A.2much$ B. tooMuch$ C. funnyMoney D. itsAllGood

A

// filename Main.java class Test { protected int x, y; } class Main { public static void main(String args[]) { Test t = new Test(); System.out.println(t.x + " " + t.y); } } A. Compiler Error B. 0 0 C. null, null D. Empty String

B

1. Who invented Java Programming? A. Guido van Rossum B. James Gosling C. Dennis Ritchie D. Bjarne Stroustrup

B

Consider the following code segment. int value = initValue; if(value > 10) if(value > 15) value = 0; else value = 1; System.out.println("value = " + value); Under which of the conditions below will this code segment print value = 1? A. initValue = 20; B. Never. Code will not compile. C. initValue = 12; D. initValue = 8;

B

How many bits char is allocated in memory A. 8 B. 16 C. 32 D. 64

B

What would be the output of the following code? int input = 5; int output = 3; input++; output += input; System.out.println(output); A. 11 B. 9 C. 10 D. 12

B

how many bits int is allocated in memory A. 8 B. 16 C. 32 D. 64

C

Consider the following code segment. int count = 1; int value = 31; while(value >= 10) { value = value - count; count = count + 3; } System.out.println(value); What is printed as a result of executing the code segment? A. 4 B. 34 C. 17 D. 9 E. 12

D

How many bits double is allocated in memory A. 8 B. 16 C. 32 D. 64

D

What would be the output for the following code: int Result = 5; System.out.print(Result); A. Result B. "Result" C. Nothing will be printed due to an error. D. 5

D

Which is valid variable name A. &Name B. !Name C. $Name D._Name A. A B. B C. D D. C and D both

D

Which statement is true about Java? A. Java is a sequence-dependent programming language B. Java is a code dependent programming language C. Java is a platform-dependent programming language D. Java is a platform-independent programming language

D

how many bits long is allocated in memory A. 8 B. 16 C. 32 D. 64

D

int num1 = 9; int num2 = 5; if(num1 > num2) { System.out.print((num1 + num2) % num2); } else { System.out.print((num1 - num2) % num2); } What is printed as a result of executing the code segment? A. 2 B. 0 C. 14 D. 4

D

x and y are declared as integer variables. You are given the following expression: x >= y Which of these expressions is the opposite of the above expression and has valid syntax? A. x =< y B. x <= y C. x == y D. x < y E. There's not enough information to determine this.

D

Consider the following code segment. int var = 12; var = var % 7; var--; System.out.println(var); What is printed as a result of executing the code segment? A. Compiler Error B. 1 C. 5 D. 2 E. 4

E

4. Which one of the following is not a Java feature? a) Object-oriented b) Use of pointers c) Portable d) Dynamic and Extensible

b

5. Which of these cannot be used for a variable name in Java? a) identifier & keyword b) identifier c) keyword d) none of the mentioned

c

Which component is used to compile, debug and execute the java programs? a) JRE b) JIT c) JDK d) JVM

c


संबंधित स्टडी सेट्स

ASP Exam - Domain 2 (Safety Management Systems)

View Set

Testout : 12.1 Laptops 12.1.10 Practice Questions

View Set

Chapter 5: Cells: The Working Units of Life

View Set

Ch. 69: Mgmt of Pts w/ Neurologic Infections, Autoimmune Disorders, & Neuropathies

View Set