Important Introduction to Programming Short Questions
Chapter: 3
Question 1:
What does the #include <iostream.h> directive do?
Answer:
It instructs the C compiler to include the contents of the system file iostream.h, which is necessary for handling input and output streams.
Chapter: 3
Question 2:
What is the role of the main() function in a C program?
Answer:
The main() function is the starting point of execution for a C program. It is a special function that the compiler looks for when running the program.
Chapter: 3
Question 3:
What is the purpose of curly braces {} in a C program?
Answer:
Curly braces {} are used to group together statements in a program, defining the body of functions like main().
Chapter: 3
Question 4:
What does the cout command do in a C program?
Answer:
cout is used for output in C++, sending data from the program to the output stream, typically the screen.
Chapter: 3
Question 5:
What does the << operator signify in a cout statement?
Answer:
The << operator directs the data towards cout, indicating that the data should be displayed on the screen.
Chapter: 3
Question 6:
What are character strings in C programming?
Answer:
Character strings in C are sequences of characters enclosed in double quotes, like "Welcome to Virtual University of Pakistan".
Chapter: 3
Question 7:
What is the significance of the semicolon ; in a C program?
Answer:
A semicolon ; marks the end of a statement in C. Omitting it results in a syntax error during compilation.
Chapter: 3
Question 8:
What is a variable in C?
Answer:
A variable in C is a named location in memory used to store data that can change during the execution of a program.
Chapter: 3
Question 9:
How should variable names be formatted in C?
Answer:
Variable names should start with a letter or an underscore, although it's recommended to avoid starting with an underscore to prevent conflicts with system variables.
Chapter: 3
Question 10:
What is an assignment operator in C, and how is it used?
Answer:
The assignment operator in C is =. It assigns the value on the right-hand side to the variable on the left-hand side.