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.

Questions and Answers

log4j Mock Test IV

Q 1 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at midnight each day?

A - '.' yyyy-MM

B - '.' yyyy-MM-dd

C - '.' yyyy-MM-dd-a

D - '.' yyyy-MM-dd-HH

Answer : B

Explanation

'.' yyyy-MM-dd − Roll over at midnight each day. This is the default value.

Q 2 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at midday and midnight of each day?

A - '.' yyyy-MM

B - '.' yyyy-MM-dd

C - '.' yyyy-MM-dd-a

D - '.' yyyy-MM-dd-HH

Answer : C

Explanation

'.' yyyy-MM-dd-a − Roll over at midday and midnight of each day.

Q 3 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at the top of every hour?

A - '.' yyyy-MM

B - '.' yyyy-MM-dd

C - '.' yyyy-MM-dd-a

D - '.' yyyy-MM-dd-HH

Answer : D

Explanation

'.' yyyy-MM-dd-HH − Roll over at the top of every hour.

Q 4 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs every minute?

A - '.' yyyy-MM-dd-HH-mm

B - '.' yyyy-MM-dd

C - '.' yyyy-MM-dd-a

D - '.' yyyy-MM-dd-HH

Answer : A

Explanation

'.' yyyy-MM-dd-HH-mm − Roll over every minute.

Q 5 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs on the first day of each week depending upon the locale?

A - '.' yyyy-MM-dd-HH-mm

B - '.' yyyy-ww

C - '.' yyyy-MM-dd-a

D - '.' yyyy-MM-dd-HH

Answer : B

Explanation

'.' yyyy-ww − Roll over on the first day of each week depending upon the locale.

Answer : A

Explanation

The log4j API provides the org.apache.log4j.jdbc.JDBCAppender object, which can put logging information in a specified database.

Answer : A

Explanation

driver − Sets the driver class to the specified string. If no driver class is specified, it defaults to sun.jdbc.odbc.JdbcOdbcDriver.

Answer : B

Explanation

password − Sets the database password.

Answer : C

Explanation

sql − Specifies the SQL statement to be executed every time a logging event occurs. This could be INSERT, UPDATE, or DELETE.

Answer : A

Explanation

URL − Sets the JDBC URL.

Answer : B

Explanation

user − Sets the database user name.

Q 12 - Is log4j thread safe?

A - true

B - false

Answer : A

Explanation

true − log4j is thread-safe.

Q 13 - The top-level layer of log4j architecture is the Logger which provides the Logger object.

A - true

B - false

Answer : A

Explanation

true − The top-level layer of log4j architecture is the Logger which provides the Logger object. The Logger object is responsible for capturing logging information and they are stored in a namespace hierarchy.

Q 14 - The layout layer of log4j architecture provides objects which are used to format logging information in different styles.

A - false

B - true

Answer : B

Explanation

true − The layout layer of log4j architecture provides objects which are used to format logging information in different styles. It provides support to appender objects before publishing logging information.

Q 15 - The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

A - false

B - true

Answer : B

Explanation

true − The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

Q 16 - The Logger object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

A - true

B - false

Answer : B

Explanation

false − The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

Q 17 - The Level object defines the granularity and priority of any logging information.

A - true

B - false

Answer : A

Explanation

true − The Level object defines the granularity and priority of any logging information. There are seven levels of logging defined within the API: OFF, DEBUG, INFO, ERROR, WARN, FATAL, and ALL.

Q 18 - The LogManager object manages the logging framework.

A - true

B - false

Answer : A

Explanation

true − The LogManager object manages the logging framework. It is responsible for reading the initial configuration parameters from a system-wide configuration file or a configuration class.

Q 19 - The log4j.properties file is a log4j configuration file which keeps properties in key-value pairs.

A - false

B - true

Answer : B

Explanation

true − The log4j.properties file is a log4j configuration file which keeps properties in key-value pairs. By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.

Q 20 - By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.

A - false

B - true

Answer : B

Explanation

true − By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.

Q 21 - Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.

A - false

B - true

Answer : B

Explanation

true − Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.

Q 22 - Logger uses the Layout objects and the conversion pattern associated with them to format the logging information.

A - true

B - false

Answer : B

Explanation

false − Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.

Q 23 - The target may be a console, a file, or another item depending on the appender.

A - true

B - false

Answer : A

Explanation

true − The target may be a console, a file, or another item depending on the appender.

Q 24 - Appender can have a threshold level associated with it independent of the logger level.

A - true

B - false

Answer : A

Explanation

true − 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 25 - The Filter objects can analyze logging information beyond level matching and decide whether logging requests should be handled by a particular Appender or ignored.

A - true

B - false

Answer : A

Explanation

true − The Filter objects can analyze logging information beyond level matching and decide whether logging requests should be handled by a particular Appender or ignored.

Answer Sheet

Question Number Answer Key
1 B
2 C
3 D
4 A
5 B
6 A
7 A
8 B
9 C
10 A
11 B
12 A
13 A
14 B
15 B
16 B
17 A
18 A
19 B
20 B
21 B
22 B
23 A
24 A
25 A
log4j_questions_answers.htm
Advertisements