Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

JAVA QUESTIONS : PART 24

Which one is a valid declaration of a boolean?

boolean b1 = 1;

boolean b2 = ‘false’;

boolean b3 = false;

boolean b4 = ‘true’

SHOW ANSWER

What is the output of this program?
class array_output {
        public static void main(String args[]) 
        {    
            char array_variable [] = new char[10];
        for (int i = 0; i < 10; ++i) {
                array_variable[i] = 'i';
                System.out.print(array_variable[i] + "" );
                i++;
            }
        } 
    }

i i i i i

0 1 2 3 4

i j k l m

None of the mentioned

SHOW ANSWER

What is the output of this program?
class Sample{
        public static void main(String args[]) 
        {
            char a = 'A';
            a++;
        System.out.print((int)a);
        } 
    }
 

66

67

65

64

SHOW ANSWER

What is the output of this program?
    class mainclass {
        public static void main(String args[]) 
        {
            boolean var1 = true;
        boolean var2 = false;
        if (var1)
            System.out.println(var1);
        else
            System.out.println(var2);
      } 
    }

0

1

true

false

SHOW ANSWER

What is the output of this program?
class booloperators {
        public static void main(String args[]) 
        {
            boolean var1 = true;
        boolean var2 = false;
        System.out.println((var1 & var2));
        } 
    }
 

0

1

true

false

SHOW ANSWER

What is the output of this program?
class asciicodes {
        public static void main(String args[]) 
        {
            char var1 = 'A';
        char var2 = 'a';
        System.out.println((int)var1 + " " + (int)var2);
        } 
    }
 

162

65 97

67 95

66 98

SHOW ANSWER

Which of the following is the advantage of BigDecimal over double?

Syntax

Memory usage

Garbage creation

Precision

SHOW ANSWER

Which of the below data type doesn’t support overloaded methods for +,-,* and /?

 int

float

double

BigDecimal

SHOW ANSWER

What is the base of BigDecimal data type?

Base 2

Base 8

Base 10

Base e

SHOW ANSWER

What is the limitation of toString() method of BigDecimal?

There is no limitation

toString returns null

toString returns the number in expanded form

toString uses scientific notation

SHOW ANSWER

BigDecimal is a part of which package?

java.lang

java.math

java.util

java.io

SHOW ANSWER

How to format date from one form to another?

SimpleDateFormat

DateFormat

SimpleFormat

DateConverter

SHOW ANSWER

How to convert Date object to String?

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");

sdf.parse(new Date());

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
sdf.format(new Date());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
new Date().parse();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
new Date().format();
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in