0

programming languages Online Quiz - 346

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

GC is a high priority thread.

  1. True

  2. False


Correct Option: B

Which one is faster in java ? a. for(int i = 100000; i > 0; i--) {} b. for(int i = 1; i < 100001; i++) {}

  1. a

  2. b

  3. same

  4. can't say


Correct Option: A

AI Explanation

To answer this question, we need to consider the difference between the two for loops.

Option A) for(int i = 100000; i &gt; 0; i--) {} - This option represents a for loop that starts with i equal to 100000 and decrements i by 1 in each iteration until i becomes 0. This loop will run 100000 times.

Option B) for(int i = 1; i &lt; 100001; i++) {} - This option represents a for loop that starts with i equal to 1 and increments i by 1 in each iteration until i becomes 100001. This loop will also run 100000 times.

Both options perform the same number of iterations, so the number of iterations is not a factor in determining which loop is faster.

However, the difference between these two options lies in the evaluation of the loop condition. In Option A, the loop condition is i &gt; 0, which is a simple comparison operation. In Option B, the loop condition is i &lt; 100001, which is also a simple comparison operation.

In terms of performance, the difference between these two loop conditions is negligible. The performance impact of the loop condition evaluation is likely to be insignificant compared to the rest of the loop body.

Therefore, the correct answer is Option A) a. The loops in both options have similar performance, but Option A has a simpler loop condition, which may result in slightly faster execution.

Which one is not correct a. Float.isNan(x); b. x == Float.NaN; c. Myobject .equals(float.NaN);

  1. a

  2. b

  3. c

  4. Don't know


Correct Option: B

What will be output from the following statements: System.out.println(1+2+"3"); System.out.println("1"+2+3);

  1. 33, 33

  2. 123, 33

  3. 33, 123

  4. 123, 123


Correct Option: C

Is the following statement correct: char ch = 'd'; if(ch < 32.00){ }

  1. True

  2. False


Correct Option: A

.NET Framework provide platform for running .NET managed code in a virtual machine

  1. True

  2. False


Correct Option: B

Code that targets the CLR is referred to as managed code

  1. True

  2. False


Correct Option: A

CIL is high-level (machine) language, like Assembler, but is Object-oriented

  1. True

  2. False


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of CIL (Common Intermediate Language) and its characteristics.

CIL is not a high-level language like Assembler. CIL is a low-level language that is used as an intermediate language in the .NET framework. It is an object-oriented assembly language that is designed to be platform-independent and to provide a common language runtime environment for different programming languages.

Therefore, the correct answer is:

B) False - CIL is not a high-level language like Assembler.

CTS is a set of specifications that all languages and libraries need to follow and will ensure interoperability between languages

  1. True

  2. False


Correct Option: B

CLR is a rich type system built into the CTS which Implements various types (int, float, string, …)

  1. True

  2. False


Correct Option: B

Base Class Library is set of basic classes: Collections, I/O, Networking, Security, etc.

  1. True

  2. False


Correct Option: A

ADO.NET provides .NET applications with access to relational databases

  1. True

  2. False


Correct Option: A

Which statement is true about a method?

  1. A method is an implementation of an abstraction

  2. A method is an attribute defining the property of a particular abstraction

  3. A method is an operation defining the behavior for a particular abstraction

  4. A method is a blueprint for making operations


Correct Option: C

How do objects pass messages in Java?

  1. They pass messages by modifying each other's fields

  2. They pass messages by calling each other's instance methods

  3. They pass messages by modifying the static variables of each other's classes

  4. They pass messages by calling static methods of each other's classes


Correct Option: B

Which of the following is not a legal identifier?

  1. a2z

  2. 52pickup

  3. _class

  4. total#


Correct Option: B

Which statement is true?

  1. new and delete are keywords in the Java language

  2. try, catch, and thrown are keywords in the Java language

  3. return, goto, and default are keywords in the Java language

  4. for, while, and next are keywords in the Java language


Correct Option: D

Which of the following primitive data types are integer types?

  1. Type boolean

  2. Type float

  3. Type byte

  4. Type double


Correct Option: C

Which of the following lines are not valid declarations?

  1. char a = '\u0061';

  2. char 'a' = 'a';

  3. char \u0061 = 'a';

  4. ch\u0061r a = 'a';


Correct Option: B

Which of the following expressions evaluates to true?

  1. (false | true)

  2. (null != null)

  3. (4 <= 4)

  4. (true & false)


Correct Option: A,C

AI Explanation

To answer this question, we need to evaluate each expression and determine which ones evaluate to true.

Option A) (false | true) - This expression uses the bitwise OR operator (|) to combine the values false and true. The result of the bitwise OR operator is true if at least one of the operands is true. In this case, since the second operand is true, the expression evaluates to true.

Option B) (null != null) - This expression checks for inequality between two null values. In Java, null represents the absence of a value. When comparing null values, they are considered equal, so the expression evaluates to false.

Option C) (4 <= 4) - This expression uses the less than or equal to operator (<=) to compare the values 4 and 4. Since 4 is equal to 4, the expression evaluates to true.

Option D) (true & false) - This expression uses the bitwise AND operator (&) to combine the values true and false. The result of the bitwise AND operator is true only if both operands are true. In this case, since one of the operands (false) is false, the expression evaluates to false.

Therefore, the expressions that evaluate to true are A) (false | true) and C) (4 <= 4).

1.Set s = new HashSet(); 2.s.add("JAVA"); 3.s.add(new Integer(5)); Line 3 will give ClassCast Exception because Two different types of object are getting added.

  1. True

  2. False


Correct Option: B
- Hide questions