You are on page 1of 13

INTERN JAVA BATCH

INSPIRE-ASSIGNMENT WEEK-1
PARAMESH G
QUESTION : 01

What will be the output of the following program?

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int $_ = 99;
System.out.println($_);
}
}

PARAMESH
QUESTION : 02

What will be the output of the following program? A) 505Inspire


Inspire505
import java.util.*;
public class Main
{ B) 55Inspire
public static void main(String args[]) Inspire505
{
System.out.println(50 + 5 + “ Inspire");
System.out.println("Inspire " + 50 + 5);
C) 55 Inspire
} Inspire 505
}
D) ERROR
QUESTION : 03

What will be the output of the following program?

import java.util.*;
public class Main A) true
{
public static void main(String args[])
{
String s1 = "Inspire";
B) false
String s2 = "Inspire";
System.out.println("s1 == s2 is:" +s1 == s2);
} C) Equal
}

A) Error
QUESTION : 04

What will be the output of the following program? A) a+b=4


class Main
a-b=2
{
public static void main(String[] args)
{ B) a+b = 3
int a=1,b=3,c;
c=a+b;
a-b = -2
System.out.println("a+b"+" "+"="+" "+c);
c=a-b;
System.out.println("a-b"+" "+"="+" "+c);
C) a+b=4
} a-b=-2
}

D) None of above
QUESTION : 05

What will be the output of the following program?


class Main
{
public static void main(String[] args) A) true true 1
{
int a = 2, b = 4,c;
c=a & b;
B) 0 6 0
System.out.print(c+" ");
c= a | b;
System.out.print(c+" ");
C) 6 -2 1
c=a >> 1;
System.out.print(c); D) 0 6 1
}
}
QUESTION : 06

What will be the output of the following program?


class Main {
public static void main(String[] args)
{
System.out.println("Size of int bytes "+(Float.SIZE/8));
System.out.println("Size of float bytes "+(Double.SIZE/8));
System.out.println("Size of char bytes "+(Character.SIZE/8));
}
}

A) 32 64 16 C) 4 4 1

B) 4 8 2 D) Error
QUESTION : 07

What will be the output of the following program? A) No. of days in


class Main Feb = 29
{
public static void main(String[] args)
{ B) No. of days in
int days;
February='2';
Feb = 28
days = (February == '2') ? 29 : 28;
System.out.println("No. of days in Feb = "+days); C)error : illegal
}
} start ofexpression
D) error:
cannot
find symbol
QUESTION : 08

What will be the output of the following program?


class Main
{
public static void main(String[] args) A) 21 20 21 20 19
{
int a =20;
System.out.print(a++ +" ");
B) 20 21 20 21 20
System.out.print(--a +" ");
System.out.print(++a +" ");
System.out.print(a-- +" ");
C) 21 20 20 19 19
System.out.println(a);
} D) 20 20 21 21 20
}
QUESTION : 09

What will be the output of the following program?


class Main
{
public static void main(String[] args) A) 1 1 1 1
{
int x=0, y=0, z=0;
int X=(++x + y++) * z++;
B) 0 0 1 1
System.out.print(X+" ");
System.out.print(x+" ");
System.out.print(y+" ");
C) 0 1 0 1
System.out.print(z);
} D) 0 1 1 1
}
QUESTION : 10

Which of the following can be operands of arithmetic operators?


A.Numeric
B.Boolean
C.Characters
D.Both Numeric & Characters

PARAMESH
INSPIRE

THANK YOU
PARAMESH G

You might also like