CIS 212 Test 1

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Xenonii
X
Xenonii
Community Contributor
Quizzes Created: 4 | Total Attempts: 992
| Attempts: 85 | Questions: 5
Please wait...
Question 1 / 5
0 %
0/100
Score 0/100
1. Which is the access modifier which makes an element accessible only from the same package or from subclasses

Explanation

The access modifier "protected" makes an element accessible only from the same package or from subclasses. This means that any class within the same package can access the protected element, as well as any subclass of the class that contains the protected element, regardless of whether the subclass is in the same package or not. This access modifier provides a level of encapsulation and restricts access to the protected element from classes outside the package or unrelated subclasses.

Submit
Please wait...
About This Quiz
Java Programming Quizzes & Trivia

This test evaluates knowledge on Java programming, focusing on abstract classes, access modifiers, method signatures, and the importance of data abstraction.

2. Why do we have different levels of access modifiers (public, protected, package, private)?

Explanation

Some elements of a class need to be part of the public interface, however you might want some of the elements to be hidden from certain classes, and not hidden from others. So the programmer has fine control on what is visible to whom

Submit
3. An abstract class is a class which

Explanation

An abstract class is a class that cannot be instantiated and is meant to be extended by other classes. It may have abstract methods, which are methods without any implementation that must be implemented by the subclasses, and it may also have defined methods, which are methods with a complete implementation. Therefore, an abstract class can have a combination of abstract and defined methods.

Submit
4. In Java how many abstract classes can I extend?

Explanation

In Java you can only extend (inherit) one class, including abstract classes.

Submit
5. What is composition?

Explanation

Composition refers to a design pattern in object-oriented programming where one object, A, has a reference to another object, B. In this pattern, only object A has a reference to object B, and it also determines the lifetime of object B. This means that if object A is destroyed or goes out of scope, object B will also be destroyed. Composition is commonly used to create complex objects by combining simpler objects, allowing for code reuse and modularity.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 03, 2008
    Quiz Created by
    Xenonii
Cancel
  • All
    All (5)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which is the access modifier which makes an element accessible only...
Why do we have different levels of access modifiers (public,...
An abstract class is a class which
In Java how many abstract classes can I extend?
What is composition?
Alert!

Advertisement