C Questions and Answers – Localization

«
»

This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Localization”.

Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.

advertisement

1. Which header file is used to define data formats and currency symbols?
a) setjmp.h
b) locale.h
c) stdarg.h
d) assert.h
View Answer

Answer: b
Explanation: locale. h is the header file which defines the location specific settings, such as data formats and currency location.

2. Which among the given macros is defined in the header file locale.h?
a) SCHAR_MAX
b) FLT_RADIX 2
c) EDOM
d) LC_CTYPE
View Answer

Answer: d
Explanation: LC_CTYPE is the macro defined under header file locale.h. This macro affects all character functions.
advertisement
advertisement

3. Which macro sets everything defined under locale. h?
a) LC_ALL
b) LC_COLLATE
c) LC_SET
d) LC_TIME
View Answer

Answer: a
Explanation: LC_ALL is the macro which sets everything. It is defined under header file locale.h.

4. Select the function that reads or sets location dependent information.
a) longjmp()
b) setlocale()
c) assert()
d) toupper()
View Answer

Answer: b
Explanation: setlocale() function reads or sets location dependent information.
The function declaration is as follows:
char *setlocale(int category, const char loc).
advertisement

5. Select the correct statement.
a) LC_MONETARY affects the monetary information
b) LC_MONETARY does not affect the monetary information
c) LC_ALL does not set everything
d) LC_CTYPE affects only one character functions
View Answer

Answer: a
Explanation: LC_MONETARY is the macro defined under header file locale.h which affects the monetary information provided by localeconv function.

6. Which macro is used in the setlocale() function?
a) LC_SET
b) FLT_RADIX 2
c) LC_MESSAGES
d) SHRT_MAX
View Answer

Answer: c
Explanation: LC_MESSAGES in the function char *setlocale(char category, const char loc) is used for system responses.
advertisement

7. LC_COLLATE affects strcoll() and strxfrm() functions.
a) true
b) false
View Answer

Answer: a
Explanation: LC_COLLATE is the macro defined under header file locale.h. It affects strcoll() and strxfrm() functions.

8. Which macro affects the strftime() function?
a) LC_TIME
b) LC_SEC
c) LC_MIN
d) LC_SET
View Answer

Answer: a
Explanation: LC_TIME is the macro defined under locale. h which affects the strftime() function.
advertisement

9. Select the macro that affects the information provided by localeconv function.
a) LC_ALL
b) LC_COLLATE
c) LC_NUMERIC
d) LC_CTYPE
View Answer

Answer: c
Explanation: LC_NUMERIC is the macro defined under the header file locale.h which affects decimal point formatting and informations provided by localeconv function.

10. What is returned by the function localeconv()?
a) current location value
b) past location value
c) pointer to the last location
d) pointer to the current location
View Answer

Answer: d
Explanation: The function returns pointer to the struct Iconv for the current location. The function os declared as follows:
struct lconv *localeconv(void).

Sanfoundry Global Education & Learning Series – C Programming Language.

To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement

Leave a Comment

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.