Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

IT114

QuestionAnswer
What is the purpose of the main method in a Java program? to serve as the entry point where the program starts execution
Is main a Java reserved word? no
Is class a Java reserved word? yes
Is void a Java reserved word? yes
Is float a Java reserved word? yes
What is a key characteristic of object-oriented programming in Java? objects encapsulate state and behavior
Is float a Java reserved word? yes
Is this a valid Java identifier? variable#name no
Is this a valid Java identifier? class no
Is this a valid Java identifier? my_Variable yes
Is this a valid Java identifier? 3variable no
What is a key characteristic of object-oriented programming in Java? objects encapsulate state and behavior
Is this a valid Java identifier? variable#name no
Is this a valid Java identifier? class no
Is this a valid Java identifier? my_Variable yes
In Java, what is a method? A named set of instructions to accomplish a task
Is this a valid Java identifier? 3variable no
What is the difference between syntax and semantics in programming? Syntax defines how code looks, and semantics defines what code does
What is the primary purpose of a programming language? to specify the words and symbols used to write a program
What is the role of the Java Virtual Machine (JVM)? To execute bytecode and translate it to machine-specific instructions
In Java, what is a method? A named set of instructions to accomplish a task
What is the difference between syntax and semantics in programming? Syntax defines how code looks, and semantics defines what code does
What is the correct syntax to cast a double value x to an integer in Java? (int) x;
Which programming language is closest to the machine's hardware? machine language
Which of the following is a common error when working with floating-point numbers in Java? double value = 1.0 / 3.0; System.out.println(value); // Output: 0.3333333333333333 Round-off errors
What is white space in a Java program? Spaces, tabs, and blank lines used to improve code readability
What is the correct syntax to cast a double value x to an integer in Java? (int) x;
Which of the following is a common error when working with floating-point numbers in Java? double value = 1.0 / 3.0; System.out.println(value); // Output: 0.3333333333333333 Round-off errors
Which data type would you use to store the value 5.99? double
How do you create a Scanner object to read input from the console in Java? Scanner input = new Scanner(System.in)
Is this a valid Java identifier? _value3 yes
How do you declare a constant in Java for the value of pi (3.14159)? constant double PI = 3.14159;
Is this a valid Java identifier? final-class no
Is this a valid Java identifier? _value3 yes
What will be the output of the following code? int a = 5; int b = a++; System.out.println(b); 5
Is this a valid Java identifier? final-class no
What will be the output of the following code? int a = 5; int b = a++; System.out.println(b); 5
What happens when you try to store a number larger than the maximum value of the int type in Java? int maxInt = 2147483647; int result = maxInt + 1; System.out.println(result); Integer overflow occurs, resulting in a wrap-around.
What happens when you try to store a number larger than the maximum value of the int type in Java? int result = 5 / 2; 2
What is the process of converting a variable from one data type to another? casting
What is the process of converting a variable from one data type to another? casting
The syntax for an assignment statement is: variable = expression;
Declare cheese as an integer variable. int cheese;
Declare cheese as a double variable. double cheese;
Put a method in the Scanner class to read a double value from the keyboard. nextDouble()
Put a method in the Scanner class to read a double value from the keyboard. nextDouble()
What will be the output of the following code? int number = 35; if (number % 2 == 0) System.out.println(“Even”) elseif (number % 5 == 0) System.out.println(“Divisible by 5”) else System.out.println(“Odd”) Divisible by 5
What is the output of this code snippet? double result = 1.0 / 0; System.out.println(result) "Infinity"
What is the result of the following code? int x = 3; int y = 2; if (x > y) if (x < 5) x++; else y++; System.out.println(x + “, “ + y); 4, 2
What is the result of the following code snippet? char ch = ‘A’; ch = (char) (ch + 3); System.out.println(ch); D
Would assigning a byte value to a short value result in data loss? No
Would casting a double value to an int value result in data loss? Yes
Would assigning a long value to an int value result in data loss? Yes
Would casting a float value to a byte value result in data loss? Yes
What will be the result of the following logical expression if x = true and y = false If (x && !y) { System.out.println(“True”); } else { System.out.println(“False”) } True
Which logical operator can be used to test if two Boolean conditions are both true? &&
What is the output of the following code? int x = 5; int y = 10; if (x < y) { if (x > 3) { System.out.println(“A”); } else { System.out.println(“B”); } } else { System.out.println(“C”); } A
What will be printed by this switch case? int x = 4; switch(x) { case 1: System.out.println(“One”); break; case 2: System.out.println(“Two”); break; case 3: System.out.println(“Three”); break; default: System.out.println(“Other”); } Other
What will the following code print if number = 8? if (number < 10) { if (number % 2 == 0) { System.out.println(“Even and Small”); } } else { System.out.println(“Large”); } Even and Small
What will the following code output if x = 7? if (x > 5 && x < 10) { System.out.println(“Valid”); } else if (x == 7) { System.out.println(“Equal”); } else { System.out.println(“Invalid”); } Valid
What will the output be for the following logical OR expression? boolean a = true; boolean b = false; if (a | | b) { System.out.println(“True”); } else { System.out.println(“False”); } True
In a conditional expression (boolean-expression) ? expression1 : expression2, what happens if the boolean-expression evaluates to true? expression1 is executed
What is the purpose of the switch statement in Java? To handle multiple possible values for a single variable
Which of the following methods rounds a number to its nearest integer in the Math class? Math.round()
Which method would convert the string "HELLO" to "hello"? str.toLowerCase()
What is the correct syntax to read an integer from user input using the Scanner class? Scanner scan = new Scanner(System.in); int x = scan.nextInt();
Which character encoding is widely used in Java to represent characters as a sequence of numbers? ASCII
What does s.charAt(1) return, given String s = "Java";? 'a'
Is this a valid declaration of a char variable in Java? char letter = 'A'; yes
Is this a valid declaration of a char variable in Java? char letter = 65; yes
Is this a valid declaration of a char variable in Java? char letter = "A"; no
What is the output of the following code: String s1 = "hello"; String s2 = "HELLO".toLowerCase() System.out.println(s1 == s2); false
Which method from the Math class returns the square root of a number? Math.sqrt()
What is the result of Math.max(10, 5)? 10
What is the ASCII value of the character 'A'? 65
What happens when a floating-point value is cast to a char in Java? It is first cast to int, and then to char
What would be the result of Math.pow(2, 3)? 8
In a while loop, when is the condition checked? Before each iteration starts
What is the final value of max in this code with input 1 5 4 3 0? 5
What will be the output of the following code? 10
In a do-while loop, how many times does the loop execute at minimum? at least once
What will be the output of the following code? no output
What will be the output for the code below with input 3 7 9 2 0? 21
What is the main difference between a while loop and a do-while loop? do-while always executes at least once before checking the condition
What are the rules of method overloading? -Methods must have same name and different parameters -Doesn't matter if the return types are different.
Created by: sumnerss
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards