Tag: technology

Questions Related to technology

  1. a. Bic

  2. b. ic

  3. c. icy

  4. d. error: no method matching substring(int,char)


Correct Option: B
Explanation:

To solve this question, the user needs to understand the concept of substring and character indices.

The given code creates a string object s with value "Bicycle". The variables iBegin and iEnd have been assigned the values 1 and 3, respectively. The substring method is then called on the string object s with two arguments: iBegin and iEnd. The substring method extracts a portion of the string starting at the index specified by iBegin and ending at the index specified by iEnd-1.

Option A is incorrect because the substring method with arguments (1,3) extracts the portion of the string starting at index 1 and ending at index 2. Thus, the output is "Bi".

Option B is correct because the substring method with arguments (1,3) extracts the portion of the string starting at index 1 and ending at index 2. Thus, the output is "ic".

Option C is incorrect because the substring method with arguments (1,3) extracts the portion of the string starting at index 1 and ending at index 2. Thus, the output is "ic", not "icy".

Option D is incorrect because the syntax of the substring method is correct, and there is a matching method signature that takes an int and a char.

Therefore, the answer is:

The Answer is: B. ic

  1. A 12

  2. B 012

  3. C 10

  4. D 10.0


Correct Option: C
Explanation:

To solve this question, the user needs to know the basics of Java programming language. The code creates an object of the Oct class and then calls the amethod() method, which initializes an integer variable oi with 012 and prints its value to the console.

In Java, leading zero in an integer literal denotes an octal (base-8) number. Therefore, the value 012 is an octal number that represents the decimal value 10.

So, the correct answer is:

The Answer is: C. 10

  1. a. The elements in a Java array can only be of primitive types, not objects

  2. b. Arrays elements are initialized to default values wherever they are created using the keword new

  3. c. An array may be dynamically resized using the setSize method

  4. d. You can find out the size of an array using the size method


Correct Option: B
  1. a float f=1/3;

  2. b int i=1/3;

  3. c float f=1.01;

  4. d double d=999d;


Correct Option: A,B,D
  1. A System.out.println(1+1);

  2. B int i=2+'2';

  3. C String s="on"+'one';

  4. D byte b=255;


Correct Option: A,B
  1. a. All of the variables in an interface are implicitly static

  2. b. All of the variables in an interface are implicitly final

  3. c. All of the methods in an interface are implicitly abstract

  4. d. A method in an interface can access class level variables


Correct Option: A,B,C