Category IS5103

IS5103 Week 1 Lab’s

LESSON-1 labs  1.  import java.io.*;  import java.util.*;  public class MyClass{   public static void main(String[]args){   Scanner in = new Scanner(System.in);   int a, b, sum;   a = in.nextInt();   b = in.nextInt();   sum = a + b;   System.out.println(“Sum = ” + sum);   } …

IS5103 WEEK-1 QUIZE’S

Q1. Which library package would you import to use NumberFormat and DecimalFormat? java.text Q2. The expression 4 + 20 / (3 – 1) ∗ 2 is evaluated to ________. 24 Q3.Which of the following expressions results in a value 1?  37 % 6 Q4. If…

IS5103 Week5 (Quiz 5 Solutions)

String[] list = {“red”, “yellow”, “green”};  String[] list = new String[]{“red”, “yellow”, “green”}; 2. Analyze the following code:  int[] list = new int[5]; list = new int[6];  The code can compile and run fine. The second line assigns a new…

IS5103 WEEK-2 QUIZE’S

Q1. How many times will the following code print “Welcome to Java”? int count = 0; do { System.out.println(“Welcome to Java”); } while (count++ < 10); 11 Q2. Which of the following is the correct expression that evaluates to true if the…

IS5103 WEEK-3 QUIZE’S

Q1. An object is an instance of a ________. class Q2. The keyword ________ is required to declare a class. class Q3. Analyze the following code: class Circle {private double radius; public Circle(double radius) {radius = radius;}}  The program will compile, but you…

IS5103 WEEK-4 QUIZE’S

Q1. Suppose your method does not return any value, which of the following keywords can be used as a return type? void Q2. Does the method call in the following method cause compile errors? No Q3. You should fill in the blank in…

IS5103 Week 6 (Quiz)

1. Analyze the following code: public class Test extends A {public static void main(String[] args) {Test t = new Test();t.print();}} class A {String s; A(String s) {this.s = s;} public void print() {System.out.println(s);}} 1. The program would compile if a default constructor…

IS5103 Week 7 (Quiz)

1. An instance of ________ describes system errors. If this type of error occurs, there is little you can do beyond notifying the user and trying to terminate the program gracefully. Error 2. The following code causes Java to throw ________. no…

IS5103 Week8 (Quiz)

1. Which library package would you import to use NumberFormat and DecimalFormat? java.text 2. The expression 4 + 20 / (3 – 1) ∗ 2 is evaluated to ________. 24 4. If x is an int and y is a float, all of the following…