Question 1
Which primitive data type stores integer values?
Correct Answer:
Int
Explanation:
Integer values are handled by primitive numeric types that represent whole numbers. Among them, the standard integer type is used for general purposes because it provides a broad range without extra memory overhead, making it the typical choice for arithmetic, counting, and indexing. In many languages, a byte uses 8 bits for very small values, a short uses 16 bits for moderate ranges, and a long uses 64 bits for very large values; the standard integer type provides a balanced default when you don’t need to optimize for extreme sizes. So the primitive that stores integer values in everyday use is the standard integer type.
Question 2
In a constant declaration, which part is the data type?
Correct Answer:
dataType
Explanation:
The data type is the type specifier that tells what kind of value the constant holds. It appears before the constant’s name, such as in a declaration like const int MAX = 100, where int is the data type. The name is the identifier you use to reference the constant, and the value is the literal assigned to initialize it. The access specifier, if present, controls visibility but is not the data type. So the data type is the part that specifies the kind of data stored by the constant.
Question 3
Which of the following is true about String in Java?
Correct Answer:
It is a class in java.lang and a non-primitive type
Explanation:
Strings in Java are reference types, not primitive values. They are implemented as objects of the String class, which lives in the java.lang package. Because it’s a class, String is a non-primitive type. Strings are immutable: once a String object is created, its character sequence cannot be changed, and operations like concatenation create new String objects. That combination—being a class in java.lang and a non-primitive type—is why this statement is correct. Other options miss or misframe the reality: primitive types are not objects and don’t have methods; string literals aren’t about being created by default in any special sense; and while Strings are immutable, that property comes from the class design, not from being primitive.
Question 4
What are unary operators?
Correct Answer:
Operators that need only one operand
Explanation:
Unary operators are the ones that act on a single value. They take one operand and produce a result. Examples include the unary minus that changes the sign of a number (-x), the logical NOT that inverts a boolean value (!x), and even unary plus or bitwise NOT (~x). The key idea is how many inputs the operator needs: one input value. This sits in contrast to binary operators, which require two operands (like a + b), and to ternary expressions, which involve three operands. The other choices describe what the operator does in terms of producing values or having zero operands, rather than describing how many inputs the operator requires.
Question 5
Which operation is an explicit narrowing cast?
Correct Answer:
int i = (int) 3.99;
Explanation:
Explicit narrowing cast means you force a value into a type with a smaller range or precision using a cast operator. In the first line, (int) 3.99 explicitly converts the floating-point literal to an int, which trims the fractional part and can lose information. That exact use of (int) is what makes it a narrowing cast. The other lines rely on implicit conversions during assignment. Moving from int to double, long, or float expands the representable range (a widening conversion) and doesn’t use an explicit cast, so they don’t demonstrate a narrowing cast.
Question 1
Exam overview

About this Exam

Prepare with the Computer Programming (COPROG) Practice Test practice quiz. This question bank includes 10 questions covering data, constant, part, java, and computer. Use it to review important concepts, identify knowledge gaps, and build confidence for the related exam, course, or assessment.

More details

Additional Information

Computer Programming (COPROG) Practice Test

This practice set contains 10 questions from the matching question bank and focuses on data, constant, part, java, and computer. Work through each question carefully, review the provided solutions, and revisit topics that need more study before your next attempt.

This is an independent study resource intended for practice and review; it is not an official examination or an endorsement by any organization named in the title.

Quiz information

Frequently Asked Questions

The complete question count is available after full access is unlocked.
No fixed duration is currently configured for this quiz.
Question explanations are included where they are available in the quiz content, helping you review the reasoning after answering.
Yes. You can retake the practice test again as you continue studying during your available access period.
After your access is confirmed, you can continue into the complete practice exam from this quiz flow.
Unless explicitly stated otherwise, this page provides independent practice material for study and exam preparation and is not the official examination itself.
Keep studying

Related Questions