- log4j Tutorial
- log4j - Home
- log4j - Overview
- log4j - Installation
- log4j - Architecture
- log4j - Configuration
- log4j - Sample Program
- log4j - Logging Methods
- log4j - Logging Levels
- log4j - Log Formatting
- log4j - Logging in Files
- log4j - Logging in Database
- log4j Useful Resources
- log4j - Questions and Answers
- log4j - Quick Guide
- log4j - Useful Resources
- log4j - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
log4j Mock Test
This section presents you various set of Mock Tests related to log4j Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
log4j Mock Test I
Q 1 - Which of the following is correct about log4j?
B - log4j has been ported to the C, C++, C#, Perl, Python, Ruby, and Eiffel languages.
C - log4j is highly configurable through external configuration files at runtime.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following log4j objects are responsible for capturing logging information?
Answer : A
Explanation
loggers − Responsible for capturing logging information.
Q 3 - Which of the following log4j objects are responsible for publishing logging information to various preferred destinations?
Answer : B
Explanation
appenders − Responsible for publishing logging information to various preferred destinations.
Q 4 - Which of the following log4j objects are responsible for formatting logging information in different styles?
Answer : C
Explanation
layouts − Responsible for formatting logging information in different styles.
Q 5 - Which of the following is correct about log4j?
B - It is optimized for speed.
Answer : D
Explanation
All of the above options are correct.
Q 6 - Which of the following is correct about log4j?
A - It supports multiple output appenders per logger.
B - It is optimized for speed.
Answer : D
Explanation
All of the above options are correct.
Q 7 - Which of the following is correct about log4j?
A - It supports internationalization.
B - It is not restricted to a predefined set of facilities.
C - Logging behavior can be set at runtime using a configuration file.
Answer : D
Explanation
All of the above options are correct.
Q 8 - Which of the following is correct about log4j?
A - It is designed to handle Java Exceptions from the start.
B - It uses multiple levels, namely ALL, TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
C - The format of the log output can be easily changed by extending the Layout class.
Answer : D
Explanation
All of the above options are correct.
Q 9 - Which of the following is correct about log4j?
C - log4j does not guarantee that each log statement will be delivered to its destination.
Answer : D
Explanation
All of the above options are correct.
Q 10 - Which of the following is correct about Logger object?
A - The top-level layer of log4j architecture is the Logger which provides the Logger object.
Answer : C
Explanation
Both of the above options are correct.
Q 11 - Which of the following is correct about Layout object?
B - It provides support to appender objects before publishing logging information.
Answer : D
Explanation
All of the above options are correct.
Q 12 - Which of the following is correct about Appender object?
A - This is a lower-level layer of log4j architecture which provides Appender objects.
Answer : C
Explanation
Both of the above options are correct.
Q 13 - Which of the following is correct about Level object?
A - The Level object defines the granularity and priority of any logging information.
Answer : C
Explanation
Both of the above options are correct.
Q 14 - Which of the following is correct about Filter object?
B - An Appender objects can have several Filter objects associated with them.
Answer : C
Explanation
Both of the above options are correct.
Q 15 - Which of the following is correct about ObjectRenderer object?
B - This object is used by Layout objects to prepare the final logging information.
Answer : C
Explanation
Both of the above options are correct.
Q 16 - Which of the following is correct about LogManager object?
Answer : C
Explanation
Both of the above options are correct.
Q 17 - Which of the following is correct about log4j.properties?
B - By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.
Answer : C
Explanation
Both of the above options are correct.
Q 18 - Which of the following is correct about layout object in Appender?
B - The Layout objects may be a console, a file, or another item depending on the appender.
C - The Layout objects is required to control the filtration of the log messages.
D - Appender can have a Layout objects associated with it independent of the logger level.
Answer : A
Explanation
layout − Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.
Q 19 - Which of the following is correct about target in Appender?
B - The target may be a console, a file, or another item depending on the appender.
C - The target is required to control the filtration of the log messages.
D - Appender can have a target associated with it independent of the logger level.
Answer : B
Explanation
target − The target may be a console, a file, or another item depending on the appender.
Q 20 - Which of the following is correct about level in Appender?
B - The level may be a console, a file, or another item depending on the appender.
C - The level is required to control the filtration of the log messages.
D - Appender can have a level associated with it independent of the logger level.
Answer : C
Explanation
level − The level is required to control the filtration of the log messages.
Q 21 - Which of the following is correct about threshold in Appender?
B - The threshold may be a console, a file, or another item depending on the appender.
C - The threshold is required to control the filtration of the log messages.
D - Appender can have a threshold associated with it independent of the logger level.
Answer : D
Explanation
threshold − Appender can have a threshold level associated with it independent of the logger level. The Appender ignores any logging messages that have a level lower than the threshold level.
Q 22 - Which of the following is correct about filter in Appender?
B - The filter may be a console, a file, or another item depending on the appender.
C - The filter is required to control the filtration of the log messages.
D - Appender can have a filter associated with it independent of the logger level.
Answer : A
Explanation
filter − The Filter objects can analyze logging information beyond level matching and decide whether logging requests should be handled by a particular Appender or ignored.
Q 23 - Which of the following method of logger print a log message in debug mode?
A - public void debug(Object message)
B - public void error(Object message)
Answer : A
Explanation
public void debug(Object message) of Logger class prints messages with the level Level.DEBUG.
Q 24 - Which of the following method of logger print a log message in error mode?
A - public void debug(Object message)
B - public void error(Object message)
Answer : B
Explanation
public void error(Object message) of Logger class prints messages with the level Level.ERROR.
Q 25 - Which of the following method of logger print a log message in fatal mode?
A - public void debug(Object message)
B - public void error(Object message)
Answer : C
Explanation
public void fatal(Object message) of Logger class prints messages with the level Level.FATAL.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | A |
3 | B |
4 | C |
5 | D |
6 | D |
7 | D |
8 | D |
9 | D |
10 | C |
11 | D |
12 | C |
13 | C |
14 | C |
15 | C |
16 | C |
17 | C |
18 | A |
19 | B |
20 | C |
21 | D |
22 | A |
23 | A |
24 | B |
25 | C |