0% found this document useful (0 votes)
3 views3 pages

Prelim - IT211 Java Answer Key

The document is a preliminary examination for Integrative Programming and Technologies at BIT International College, consisting of multiple-choice questions, identification, true or false statements, enumeration, and short response sections. It covers fundamental concepts of Java programming, including syntax, data types, and the Java Development Kit (JDK). The examination aims to assess students' understanding of Java programming principles and practices.

Uploaded by

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

Prelim - IT211 Java Answer Key

The document is a preliminary examination for Integrative Programming and Technologies at BIT International College, consisting of multiple-choice questions, identification, true or false statements, enumeration, and short response sections. It covers fundamental concepts of Java programming, including syntax, data types, and the Java Development Kit (JDK). The examination aims to assess students' understanding of Java programming principles and practices.

Uploaded by

bergantinedelyn
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

BIT INTERNATIONAL COLLEGE

City of Tagbilaran

COLLEGE OF ENGINEERING AND TECHNOLOGY

Preliminary Examination in Integrative Programming and Technologies

Name: _________ Admission Number: _______________


Date Administered: ________ Score: _______________
General Directions: Read carefully and understand the given instructions. Avoid Erasure

I. MULTIPLE CHOICE. Direction: Read and answer each item carefully. Write only the letter of your
answer on the space provided. (2 pts. each)

_____1. What does the public static void main(String [] args) method represent in a Java program?
A) It is used to define the class structure. C) It initializes instance variables.
B) It is the entry point of the Java program. D) It defines the access modifiers
_____2. Which of the following is the correct way to declare a variable in Java?
A) int number; C) variable int number;
B) number int; D) int = number;
_____3. Which Integrated Development Environment (IDE) is commonly used for Java development?
A) Visual Studio Code C) Xcode
B) Eclipse D) CodeBlocks
_____4. Which file extension is used for Java source files?
A) .class C) .jar
B) .exe. D) java
_____5. What is the primary purpose of the Java programming language?
A) To manage hardware resources directly C) To develop platform-independent applications
B) To create web pages and design D) To execute more SQL queries on the databases
_____6. If you want to print "Hello, World!" to the console in Java, which code snippet would you use?
A) [Link]("Hello, World!"); C) [Link]("Hello, World!");
B) print("Hello, World!"); D) [Link]("Hello, World!");
_____7. What is the role of the main method in a Java program?
A) It defines the class structures. C) It serves as the entry point of the program.
B) It provides a graphical user interface. D) It handles errors and exceptions in the program.
_____8. Which of the following is a feature of Java programming language?
A) Java is a platform-independent. C) Java is a procedural programming language.
B) Java is a compiled language. D) Java does not support exception handling.
_____9. What does the [Link]() method do in Java?
A) It reads input from the user. C) It opens a file for reading messages.
B) It writes output to the console. D) It terminates the Java program execution.
_____10. What is the purpose of the Java Development Kit (JDK)?
A) To provide tools for creating databases C) To design graphical user interfaces
B) To manage version control D) To compile and run Java applications
_____11. What is the purpose of the ; (semicolon) in Java?
A) To denote the end of a statement C) To start a new class definition
B) To separate different methods D) To indicate a comment in the code
_____12. Which of the following is a primitive data type in Java?
A) String C) int
B) ArrayList D) HashMap
_____13. What is the size of a double data type in Java?
A) 8 bits C) 32 bits
B) 16 bits D) 64 bits
_____14. What will be the output of the following Java code?
Java code
int x = 40;
int y = 20;
int z = x + y;
[Link](z);
A) 70 C) 60
B) 20 D) 40
_____15. Which operator is used to increment a variable by 1 in Java?
A) ++ C) +=
B) -- D) -

II. IDENTIFICATION. Direction: Identify the terms asked in the following statements. Write your
answer on the space provided. (2 pts. each)

________________1. This data type is used to store a single character in Java. char
________________2. The default value of a boolean variable in Java. False
________________3. This operator is used to check for equality between two values in Java. ==
________________4. This data type is used to store text and it is surrounded by double quotes. String
________________5. It is used to assign values to the variable. Equal sign
________________6. This conditional statement is used to specify a block of code to be executed, if a
specified condition is true. If statement
________________7. This data type can be used instead of int to save memory when you are certain
that the value will be within -128 and 127. byte
________________8. This data type is used to store whole numbers from -32768 to 32767. short
________________9. This data types is used to store fractional numbers. float and double
________________10. This conditional statement is used to specify a block of code to be executed, if
a specified condition is false. else statement

III. TRUE or FALSE. Write TRUE if the statement is correct otherwise FALSE if the statement is
incorrect. Write your answer on the space provided.

________1. Java is not a case-sensitive. False


________2. The main() method is required and you will see it in every Java program. True
________3. The curly braces {} marks the beginning and the end of a block of code. True
________4. Variables are not containers for storing data values. False
________5. Single-line comments start with three forward slashes (///). False

IV. Enumeration. Direction: Enumerate the following components related to platform technologies.
1. List at least six (6) logical conditions from mathematics in Java.
Answer:

 Less than: a < b


 Less than or equal to: a <= b
 Greater than: a > b
 Greater than or equal to: a >= b
 Equal to a == b
 Not Equal to: a != b
2. List the eight (8) primitive data types in Java.
Answer: byte,short,int, long, float,double, Boolean, char

3. List the five (5) Java operators used to perform operations on variables and values.
Answer:

 Arithmetic operators
 Assignment operators
 Comparison operators
 Logical operators
 Bitwise operators

V. Short Response. Read and answer each item carefully. Write your answer on the space provided.
Criteria: Content 2 Conventions in sentence writing 3 = 5 points each

[Link] are the benefits of using Java?


Answer:

Portability: Java code can be run on any platform that has a Java Virtual Machine (JVM).
Security: Java has a built-in security model that helps to protect users from malicious code.
Object-oriented: Java is an object-oriented programming language, which makes it easy to create
modular and reusable code.
Robust: Java is a robust language that is designed to be reliable and efficient.
Widely used: Java is a widely used language that has a large community of developers and
support resources.

2. What is the difference between JDK and JRE?


Answer:
The JDK (Java Development Kit) is used by developers for creating Java applications and includes the
necessary tools, libraries, and compilers.
The JRE (Java Runtime Environment) is used by end-users to run Java applications and provides the
runtime environment and essential class libraries, but does not include development tools.

You might also like