Skip to main content

Important Introduction to Programming Short Questions

Chapter: 17
Question 1:
What does the strlen function return?
Answer: The strlen function returns the length of a string, excluding the null character at the end.
Chapter: 17
Question 2:
What is the use of strcat in string handling?
Answer: The strcat function concatenates (appends) one string to the end of another.
Chapter: 17
Question 3:
How does strncpy differ from strcpy?
Answer: The strncpy function copies a specified number of characters from one string to another, while strcpy copies the entire string.
Chapter: 17
Question 4:
What is the purpose of strncat?
Answer: The strncat function appends a specified number of characters from one string to the end of another.
Chapter: 17
Question 5:
Why are atoi, atol, and atof functions used?
Answer: The atoi, atol, and atof functions are used to convert strings to integers, long integers, and floating-point numbers, respectively.
Chapter: 17
Question 6:
How does the strtod function work?
Answer: The strtod function converts a string to a double-precision floating-point number.
Chapter: 17
Question 7:
What is the significance of the null character \0 in strings?
Answer: The null character \0 signifies the end of a string in C, marking where the sequence of characters terminates.
Chapter: 17
Question 8:
In which header file are the string manipulation functions like strcpy and strcmp found?
Answer: The string manipulation functions like strcpy and strcmp are found in the string.h header file.
Chapter: 17
Question 9:
How are non-printable characters like spaces represented in the ASCII table?
Answer: Non-printable characters like spaces are represented in the ASCII table with specific integer values, e.g., space is represented by the value 32.
Chapter: 17
Question 10:
What does the strncat function return?
Answer: The strncat function returns a pointer to the resulting string after appending a specified number of characters.