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 III

Answer : A

Explanation

x − Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.

Answer : B

Explanation

X − The X conversion character is followed by the key for the MDC. For example, X{clientIP} will print the information stored in the MDC against the key clientIP.

Answer : A

Explanation

%20c − Left pad with spaces if the category name is less than 20 characters long.

Answer : B

Explanation

%-20c − Right pad with spaces if the category name is less than 20 characters long.

Answer : C

Explanation

%.20c − Truncate from the beginning if the category name is longer than 20 characters.

Q 11 - Which of the following set the content type of html generated using HTMLLayout?

A - HTMLLayout.setContentType(String)

B - HTMLLayout.setLocationInfo(String)

C - HTMLLayout.setTitle(String)

D - None of the above.

Answer : A

Explanation

HTMLLayout.setContentType(String) − Sets the content type of the HTML content. Default is text/html.

Q 12 - Which of the following set the location information for the logging event using HTMLLayout?

A - HTMLLayout.setContentType(String)

B - HTMLLayout.setLocationInfo(String)

C - HTMLLayout.setTitle(String)

D - None of the above.

Answer : B

Explanation

HTMLLayout.setLocationInfo(String) − Sets the location information for the logging event. Default is false.

Answer : C

Explanation

HTMLLayout.setTitle(String) − Sets the title for the HTML file. Default is log4j Log Messages.

Answer : A

Explanation

immediateFlush − This flag is by default set to true, which means the output stream to the file being flushed with each append operation.

Answer : B

Explanation

encoding − It is possible to use any character-encoding. By default, it is the platform-specific encoding scheme.

Answer : C

Explanation

threshold − The threshold level for this appender.

Answer : D

Explanation

Filename − The name of the log file.

Answer : A

Explanation

fileAppend − This is by default set to true, which means the logging information being appended to the end of the same file.

Answer : B

Explanation

bufferedIO − This flag indicates whether we need buffered writing enabled. By default, it is set to false.

Answer : C

Explanation

bufferSize − If buffered I/O is enabled, it indicates the buffer size. By default, it is set to 8kb.

Answer : A

Explanation

maxFileSize − This is the critical size of the file above which the file will be rolled.

Answer : A

Explanation

maxFileSize − This is the critical size of the file above which the file will be rolled.

Answer : B

Explanation

maxBackupIndex − This property denotes the number of backup files to be created.

Answer : C

Explanation

DatePattern − This indicates when to roll over the file and the naming convention to be followed. By default, roll over is performed at midnight each day.

Q 25 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at the end of each month and at the beginning of the next month?

A - '.' yyyy-MM

B - '.' yyyy-MM-dd

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

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

Answer : A

Explanation

'.' yyyy-MM − Roll over at the end of each month and at the beginning of the next month.

Answer Sheet

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