Important Instructions for All BCA / B.
Sc IT Students
• All students must submit their assignment on 14/04/2025.
• The assignment must be written in a separate Notebook purchased
specifically for assignments.
The Notebook should have ruled lines on the right side and plain
space on the left side.
• All future assignments will be maintained in the same assignment
Notebook, so purchase accordingly.
• Late submissions will not be accepted unless there is a valid reason with
proof.
• Plagiarism or copying from other students may lead to zero marks.
• Write each question clearly and answer them in your own words with
example programs.
Unit 2 Assignment Questions – C++ Programming Basics
1. Explain the structure of a C++ program with an example.
o Write a simple program that takes two numbers as input and
displays their sum.
2. What is a namespace in C++?
o Describe its use with an example using the std namespace. Also,
explain what happens if we don’t use a namespace in a program.
3. Differentiate between variables, constants, and enumerations in C++.
o Write a C++ program to declare each of these and demonstrate
their usage with appropriate examples.
4. Write a C++ program using different types of operators (arithmetic,
relational, logical).
o Explain how typecasting is used in your program.
(Example: Casting float to int or vice versa)
5. Identify valid and invalid identifiers in the following list. Give reasons
for your answers.
int 2value;
float _amount;
char name@;
double rate_of_interest;
string firstName;