Skip to main content

Important Introduction to Programming Short Questions

Chapter: 22
Question 1:
What is the purpose of the continue statement in loops?
Answer: The continue statement skips the remaining statements in the current iteration of the loop and proceeds to the next iteration.
Chapter: 22
Question 2:
Explain the concept of call by value.
Answer: In call by value, a copy of the argument's value is passed to the function, leaving the original variable unchanged.
Chapter: 22
Question 3:
What does call by reference use to modify variables?
Answer: Call by reference uses pointers to pass the address of variables, allowing the function to modify the original variables directly.
Chapter: 22
Question 4:
What is an array in C/C++?
Answer: An array is a collection of variables of the same data type stored in contiguous memory locations, accessible by an index starting from 0.
Chapter: 22
Question 5:
How are arrays passed to functions in C/C++?
Answer: Arrays are passed to functions by reference by default, meaning the function receives a reference to the original array rather than a copy.
Chapter: 22
Question 6:
What is the role of pointers in C/C++?
Answer: Pointers store memory addresses of variables, enabling functions to modify variables directly and facilitating dynamic memory management.
Chapter: 22
Question 7:
How do you increment a variable using the compound assignment operator?
Answer: To increment a variable, you can use the compound assignment operator +=, such as a += 1, which adds 1 to the variable a.
Chapter: 23
Question 8:
What is the purpose of a preprocessor in C?
Answer: The preprocessor enhances C code by making modifications before compilation, such as including files.
Chapter: 23
Question 9:
What does the #include directive do in C?
Answer: It includes the content of another file into the current source file.
Chapter: 23
Question 10:
How does #include <filename> differ from #include "filename"?
Answer: <filename> searches in specific directories, while "filename" searches in the current working directory.