Annotations Flashcards

1
Q

What is the primary purpose of annotations?

A

To provide additional information or comments about a particular piece of data or code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: Annotations can only be used in programming languages.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Fill in the blank: Annotations are often used to enhance ________ in documentation.

A

clarity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an example of an annotation in literature?

A

Footnotes or endnotes that provide explanations or references.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which programming language uses annotations to provide metadata about classes, methods, and fields?

A

Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Multiple Choice: Which of the following is NOT a type of annotation? A) Marker B) Single-value C) Multi-value D) Function

A

D) Function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the ‘@Override’ annotation indicate in Java?

A

It indicates that a method is intended to override a method in a superclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: Annotations can be inherited by subclasses in object-oriented programming.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a common use of annotations in web development?

A

To define routing and behavior of web services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Fill in the blank: Annotations in Python are often implemented using ________.

A

decorators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between a marker annotation and a single-value annotation?

A

A marker annotation has no elements, while a single-value annotation has one element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Multiple Choice: Which of these is an example of a standard annotation in Java? A) @Entity B) @Route C) @Custom D) @Service

A

A) @Entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False: Annotations can be used for configuration purposes in frameworks.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the role of the ‘@Deprecated’ annotation?

A

It indicates that a method or class should no longer be used and may be removed in future versions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Fill in the blank: Annotations can facilitate ________ by allowing developers to add metadata to code.

A

reflection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the term for annotations that provide a way to associate metadata with program elements?

A

Metadata annotations

17
Q

Multiple Choice: Which annotation is used for testing in JUnit? A) @Test B) @Execute C) @Run D) @Check

18
Q

True or False: Annotations can affect the behavior of a program at runtime.

19
Q

What is a common annotation used in Spring Framework?

A

@Autowired

20
Q

Fill in the blank: Annotations in XML can be replaced by ________ in programming.

A

code annotations

21
Q

What does the ‘@FunctionalInterface’ annotation signify in Java?

A

It indicates that an interface is intended to be a functional interface.

22
Q

Multiple Choice: Which of the following is a characteristic of annotations? A) They can be compiled B) They can be executed C) They can be inherited D) Both A and C

A

D) Both A and C

23
Q

What is the main advantage of using annotations in code?

A

They improve readability and maintainability by reducing the need for boilerplate code.

24
Q

True or False: Annotations can be removed from code without affecting its functionality.

25
Q

What is the purpose of the ‘@SuppressWarnings’ annotation?

A

To suppress compiler warnings for specific sections of code.

26
Q

Fill in the blank: Annotations can be processed at ________, allowing for dynamic behavior adjustments.