B.Tech CSC - IV Sem Quiz I Time: 50 Min. Marks:10 (Weightage:2.5) Name: Reg No

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

B.

Tech CSC – IV Sem


Quiz I
Time: 50 min. Marks:10 (Weightage:2.5)
Name: Reg No:

Instructions:
- All questions are compulsory and carry equal marks
- Attempt the answer on the given sheet
Q1. What will be the output of the following code, if there is an error, specify the reason for the error:

(a) class Hello { int k; } (b) class Main


class Test { { public static void main(String[] args) {
public static void main(String args[]) { double i = 100.01;
Hello ob; long j = d;
System.out.println(ob.k); }} System.out.println("j= " + j);
}}

Q2. Why is java known as Platform Independent language?

Q3. What will be the output of the following code, if there is an error, specify the reason for the error:

(a) class Main { (b) class Test{


public static void main(String args[]) { public static void main(String[] args) {
byte a = 16; int i = 100;
System.out.println(a); long j = i;
a++; float k = j;
System.out.println(a)`; System.out.println("i= " + i+“j="+ j+ "k="+ k);
a++; } }
System.out.println(a);
a++;
System.out.println(a); }

(c) class Main { (d) class Main {


public static void main(String args[]) { public static void main(String args[])
byte b =50; { int i;
b = b*2; }} System.out.println(i+2); } }
(e) class Hello{ (f) class Test {
public static void main(String args[]) { public void main( String[] args ) {
double a = 376.9; System.out.print ( "bye" + “\nhi” );
int b = 456; System.out.println ( "helllo" ); } }
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
} }

Q4. Define various data types in terms of its purpose, size, range and default value?

Q5. Define the role of JVM and JRE?

You might also like