0% found this document useful (0 votes)
28 views2 pages

Predict Ouptups

Uploaded by

Abdul Rafay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Predict Ouptups

Uploaded by

Abdul Rafay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

public class QuizQuestion1 {

public static void main(String[] args) {


int a = 5;
int b = 2;
int c = ++a * b--;
System.out.println("c = " + c);
}
}

public class QuizQuestion2 {


public static void main(String[] args) {
int x = 10;
System.out.println(x > 5 && x < 20);
System.out.println(x > 5 || x < 3);
System.out.println(!(x > 5 && x < 20));
}
}

public class QuizQuestion3 {


public static void main(String[] args) {
String str1 = "hello";
String str2 = "world";
String result = str1 + str2;
System.out.println(result);
}
}

public class QuizQuestion4 {


public static void main(String[] args) {
String str = "Java";
str.concat("Programming");
System.out.println(str);
}
}

public class QuizQuestion5 {


public static void main(String[] args) {
int[] array = new int[5];
System.out.println(array[3]);
}
}

public class QuizQuestion6 {


public static void main(String[] args) {
String[] names = {"Alice", "Bob", "Charlie"};
for (int i = 0; i <= names.length; i++) {
System.out.println(names[i]);
}
}
}

public class QuizQuestion7 {


public static void main(String[] args) {
int num = 10;
switch (num) {
case 5:
System.out.println("Five");
break;
case 10:
System.out.println("Ten");
break;
case 15:
System.out.println("Fifteen");
break;
default:
System.out.println("Default");
}
}
}

public class QuizQuestion8 {


public static void main(String[] args) {
int a = 10;
int b = 20;
int c = a > b ? a : b;
System.out.println(c);
}
}

public class QuizQuestion9 {


public static void main(String[] args) {
int i = 1;
while (i <= 5) {
System.out.print(i + " ");
i++;
}
}
}

public class QuizQuestion10 {


public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
System.out.print(i + " ");
continue;
}
}
}

You might also like