0

programming languages Online Quiz - 282

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

I am having multivalue field containing numeric value, I want to apply formula on each value of the field. Which of the formula will accomplish the task?

  1. @Transform

  2. @Replace

  3. @ListEvaluate

  4. @ListProcess


Correct Option: A

Which one of following is not a valid shared resource image type?

  1. GIF

  2. JPG

  3. MBP

  4. TIF


Correct Option: D

Which one of the following design element is multi pane interface?

  1. View

  2. Outline

  3. Frameset

  4. Page


Correct Option: C

Which one of the following @function performs a similar function to the Print method of the Lotus Script?

  1. @Print

  2. @StatusBar

  3. @MessageBox

  4. @MessageBar


Correct Option: B

Which one of the following returns the name of the Current Field?

  1. @Name

  2. @FieldName

  3. @ThisName

  4. @FieldTitle


Correct Option: C
  1. @VerifyPassword

  2. @Compare

  3. @PasswordCompare

  4. @HashCompare


Correct Option: A

Which one of the following @function is used to get value of the field?

  1. @GetField

  2. @GetItemValue

  3. @GetFieldvalue

  4. @Value


Correct Option: A

Which one of the following @function is used to display all Response document and Response to Response document of the parent document?

  1. @Responses

  2. @AllChildren

  3. @AllDescendents

  4. @AllResponses


Correct Option: C

Which option most fully describes will happen when you attempt to compile and run the following code public class MyAr{ public static void main(String argv[]) { MyAr m = new MyAr(); m.amethod(); } public void amethod(){ static int i; System.out.println(i); } }

  1. Compilation and output of the value 0

  2. Compile time error because i has not been initialized

  3. Compilation and output of null

  4. Compile time error


Correct Option: D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Compilation and output of the value 0 - This option is incorrect because the code will not compile due to an error.

Option B) Compile time error because i has not been initialized - This option is incorrect because the error in the code is not related to the initialization of the variable i.

Option C) Compilation and output of null - This option is incorrect because the code will not compile due to an error.

Option D) Compile time error - This option is correct because the code will not compile successfully. The error occurs in the method amethod() where the variable i is declared with the keyword static inside a non-static method. This is not allowed in Java and results in a compile-time error.

The correct answer is option D) Compile time error.

Which of the following will compile correctly

  1. short myshort = 99S;

  2. String name = 'Excellent tutorial Mr Green';

  3. char c = 17c;

  4. int z = 015;


Correct Option: D

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) short myshort = 99S; - This option is incorrect because the letter 'S' at the end of the number is not a valid suffix for a short data type. The correct suffix for a short data type is 's' (lowercase).

Option B) String name = 'Excellent tutorial Mr Green'; - This option is incorrect because string literals in Java should be enclosed in double quotation marks ("). Single quotation marks (') are used for character literals.

Option C) char c = 17c; - This option is incorrect because the letter 'c' at the end of the number is not a valid suffix for a char data type. If you want to assign a numeric value to a char variable, you can use a numeric literal without any suffix.

Option D) int z = 015; - This option is correct because the number 015 is a valid octal (base 8) literal in Java. Octal literals are represented by a leading zero (0) followed by digits from 0 to 7.

The correct answer is D. This option is correct because it assigns a valid octal value to an int variable.

Which of the following are Java key words

  1. double

  2. Switch

  3. then

  4. instanceof


Correct Option: A,D

Which of the following are Java modifiers?

  1. public

  2. private

  3. friendly

  4. transient


Correct Option: A,B,D

AI Explanation

To answer this question, we need to understand what Java modifiers are.

Java modifiers are keywords that are used to modify classes, methods, and variables in Java. They specify the access level, visibility, and behavior of a class, method, or variable.

Let's go through each option to understand why it is correct or incorrect:

Option A) public - This option is correct because "public" is a Java modifier. It is used to specify that a class, method, or variable is accessible from anywhere.

Option B) private - This option is correct because "private" is a Java modifier. It is used to specify that a class, method, or variable is only accessible within the same class.

Option C) friendly - This option is incorrect because "friendly" is not a valid Java modifier. The correct keyword is "default", which is used when no access modifier is specified. It specifies that a class, method, or variable is accessible within the same package.

Option D) transient - This option is correct because "transient" is a Java modifier. It is used to specify that a variable should not be serialized when an object is serialized.

The correct answer is A, B, and D. These options are correct because "public", "private", and "transient" are valid Java modifiers.

Why might you define a method as native?

  1. to get to access hardware that Java does not know about

  2. to define a new data type such as an unsigned integer

  3. to write optimised code for performance in a language such as C/C++

  4. to overcome the limitation of the private scope of the method


Correct Option: A,C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) To get access to hardware that Java does not know about - This option is correct because defining a method as native allows you to access hardware resources or libraries that are not directly supported by Java. By writing native code in a language such as C or C++, you can interact with the hardware or use system-level libraries that Java does not provide direct access to.

Option B) To define a new data type such as an unsigned integer - This option is incorrect. Defining a new data type or extending the Java type system is not the purpose of declaring a method as native.

Option C) To write optimized code for performance in a language such as C/C++ - This option is correct. By declaring a method as native, you can write performance-critical code in a lower-level language like C or C++. This can be beneficial when you need to achieve better performance than what Java's virtual machine provides.

Option D) To overcome the limitation of the private scope of the method - This option is incorrect. Declaring a method as native does not affect the scope of the method. The private scope of a method is determined by the access modifier, not by declaring it as native.

The correct answers are A and C. These options are correct because defining a method as native allows you to access hardware resources that Java does not know about and write optimized code for performance in a language such as C/C++.

What gets printed when the following program is compiled and run. Select the one correct answer. class test { public static void main(String args[]) { int i,j,k,l=0; k = l++; j = ++k; i = j++; System.out.println(i); } }

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) 0 - This option is incorrect because the value of "i" is incremented after being assigned to "j" in the statement "i = j++". Therefore, the value of "i" will be 1, not 0.

Option B) 1 - This option is correct because the value of "i" is incremented after being assigned to "j" in the statement "i = j++". Therefore, the value of "i" will be 1.

Option C) 2 - This option is incorrect because the value of "i" is incremented after being assigned to "j" in the statement "i = j++". Therefore, the value of "i" will be 1, not 2.

Option D) 3 - This option is incorrect because the value of "i" is incremented after being assigned to "j" in the statement "i = j++". Therefore, the value of "i" will be 1, not 3.

The correct answer is B) 1. This option is correct because the value of "i" is incremented after being assigned to "j" in the statement "i = j++". Therefore, the value of "i" will be 1.

Which one does not have a ValueOf(String) method?

  1. integer

  2. boolean

  3. character

  4. long


Correct Option: C

Which one does not extend java.lang.Number?

  1. integer

  2. boolean

  3. character

  4. short


Correct Option: B,C

Which of the following is the correct syntax for suggesting that the JVM performs garbage collection?

  1. System.free()

  2. System.setGarbageCollection()

  3. System.setGarbage()

  4. System.gc()


Correct Option: D
- Hide questions