CodeCraft Essentials
222 subscribers
187 photos
39 videos
49 files
164 links
Download Telegram
Now, let's proceed to tackle some exam questions.
what is the value if the following code is executed(Assume the value entered by user is 18)?
import java.util.*;

public class calculate {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num1, num2;

num2 = 6;
System.out.println("Enter value: ");
num1 = sc.nextInt();

num1 = num1 + 2;
num2 = num1 / num2;

System.out.println("Result = " + num2);
}
}
What are the values of numFruit, numOrange and numApples respecively after the following code is excuted:

int numOrange = 5;
int numApple = 10;
int numFruit;
numFruit = numOrange++ + numApple + ++numOranges;
What is the output after the following code is excuted?
char grades = 'B';
switch(grades){
case 'A':
System.out.println("A ");
Break;
case 'B':
System.out.println("B ");

case 'C':
System.out.println("C ");
Break;
default:
System.out.println("F ");
}
Today's questions can be quite tricky, especially for those who approached them with a Python mindset. 🤔
That was all for today have a good night and see you on tomorrow's session✌️
🔔Greetings, everyone!

I wanted to give you a friendly reminder that our session will begin in a mere 10 minutes. Please ensure that your working environment is prepared for the lab. Let's make the most of this session together! 😊
Today, we will be proceeding with Lab 3. I highly encourage each of you to dedicate the next 15 minutes to independently tackling the question.
Now, let's move on to addressing some exam questions
Consider the following line of code:
class Output{
public static void main(String[] args){
if (args.length == 0) { return;}
int min = Integer.parseInt(args[0]);
for (int i=1; 1 < args.length; i++){
if (Integer.parseInt (args[ i ]) < min){
min = Integer.parseInt (args [i]);
}
}
System.out.println(min);
}
}


After executing the following on the command prompt what will the outputprinted on the screen?

java Output 3 2 8 2 4
👍1
?
Anonymous Quiz
0%
4
15%
3
21%
8
65%
2
🔔Hello, everyone!

Just a quick reminder that our session will commence in just 10 minutes. Please take a moment to ensure that your working environment is ready for the lab. Let's make this session productive and enjoyable! 😊
Today, we will be advancing to Lab 4. I strongly urge each of you to allocate the next 15 minutes to independently engage with the question and work on it.
Now, we will proceed to tackle a few exam questions.🗓
Choose the correct statement for the code below:

public class AnyProg{
public static void main(String[] args){
int X, Y;
X = 7;
X++;
Y = X;
X = X * 3;
System.out.println("the value of Y is " + Y);
}
}