Skip to main content

Important Introduction to Programming Short Questions

Chapter: 17
Question 1:
What is the output of the program if strcat(s1, s2) is used with s1 = "Hello " and s2 = "World"?
Answer: The output will be "Hello World", as strcat appends s2 to the end of s1.
Chapter: 17
Question 2:
How does the isupper function determine its return value?
Answer: The isupper function returns true if the character passed is an uppercase letter, otherwise, it returns false.
Chapter: 17
Question 3:
What will strcmp("Hello", "hello") return?
Answer: strcmp("Hello", "hello") will return a negative value because uppercase 'H' is lexicographically less than lowercase 'h'.
Chapter: 17
Question 4:
Explain the use of the getchar() function in C.
Answer: The getchar() function reads a single character from the input buffer or keyboard and returns it. It's useful for reading individual characters in a loop.
Chapter: 17
Question 5:
What does isgraph function check for?
Answer: The isgraph function checks if a character is a printable character other than space, returning true if it is.
Chapter: 17
Question 6:
When would you use strtol instead of atoi?
Answer: strtol is used for converting a string to a long integer and allows specification of the base, whereas atoi converts to a regular integer with base 10 by default.
Chapter: 18
Question 7:
What is a file in a computer system?
Answer: A file in a computer system is a collection of characters, words, sentences, and paragraphs stored as text or executable program files.
Chapter: 18
Question 8:
What are the primary types of files in a computer?
Answer: The primary types of files are text files (containing readable English characters) and executable program files (which run programs).
Chapter: 18
Question 9:
What is a plain text file?
Answer: A plain text file contains ordinary text without any formatting, such as the files created with Notepad.
Chapter: 18
Question 10:
What differentiates a formatted text file from a plain text file?
Answer: A formatted text file contains text along with formatting information like bold, italic, and underlined text, whereas a plain text file only contains unformatted text.