0% found this document useful (0 votes)
30 views

Class Vii - Chapter-3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Class Vii - Chapter-3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

BHAVAN’S PUBLIC SCHOOL, DOHA – QATAR

COMPUTER SCIENCE NOTES 2023-24


CLASS VII

CHAPTER 3

INTRODUCTION TO C++

MCQS (Multiple Choice Questions)

1.C++ is one of the :

Ans: Object-oriented languages

2. C++ is case sensitive as it treats upper and lower case characters :

Ans: Differently

3. Not a C++ fundamental data type :

Ans: All of the above

4. All the header files have extension :

Ans:.h

5. The header file which is required for input/output system.

Ans: iostream

6. C++ comments are given with :

Ans: Both

7. C++ different types of loop control structures :

Ans: FOR LOOP

BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 1


8. Statement successively tests the value of an expression against a list of integer
or character constants.

Ans:switch

Fill in the blanks :

(a) The void data type is used for empty set of values.

(b) All C++ programs consist of one or more function

(c) If any of the value does not match in SWITCH statement, then default is

executed.

(d) A goto statement can transform program control anywhere.

(c ) iostream header file is included to use cin and cout.

Write True or False :

(a) C++ is case sensitive.-True

b) Array is a fundamental data type.-False

(c) The function main() is the basic function for all programs.- True

(d)A function is open and closed by curly braces.- True

(e) Return 0 prints the end of the program. .-False

ANSWER THE FOLLOWING:

1. Write a C++ program to print the name of your school.

ANS:

#include <iostream>

using namespace std;


BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 2
int main()

cout <<”Bhavan’s Pubic School”;

return 0;

2. Write a C++ program to print the value of a variable.

ANS:

# include <iostream>

using namespace std;

int main()

int price=200;

cout << “item price”;

cout<< price;

return 0;

3. Write a program to read the value of a variable and print it.

ANS:

# include <iostream>

using namespace std;

int main()
BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 3
{

int item;

cout << “Enter the value for item”;

cin>> item;

cout<<”The value of item is”<<item;

return 0;

4. Write a program to add three numbers.

ANS:

# include <iostream>

using namespace std;

int main()

int a,b,c,sum;

cout << “Enter the first number”;

cin>> a;

cout << “Enter the second number”;

cin>> b;

cout << “Enter the third number”;

cin>> c;

sum =a+b+c;

BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 4


cout<<”the sum of three numbers are”<<sum;

return 0;

5. Write a C++ program to do all arithmetic operations.

ANS:

# include <iostream>

using namespace std;

int main()
{
int a,b;
cout << “Enter the first number=”;
cin>> a;
cout << “Enter the second number=”;

cin>> b;

cout << “the sum is:”;


cout << a+b;
cout<<”the difference is:”;
cout << a-b;
cout << “the product is:”;
cout << a*b;
cout << “the quotient is:”;
cout << a/b;
return 0;
}

BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 5


6. What are identifiers?

ANS:

Identifiers are the variables in C++ used for defining variables, constants and
functions. Identifiers must begin with a letter(a….z or A….Z) or an underscore (
_ ) .Uppercase and Lowercase letters are different.

Eg: name, MARKS, Price, student_1

7. What is the use of header file?

ANS: A header file is a file with extension .h which contains C++ function
declarations and macro definitions to be shared between several source files.

These files are found in compilers INCLUDE subdirectory. A header file is


generally used to define all of the functions, variables and constants contained in
any function library that you might want to use.The #include directive instructs
the compiler to include the contents of the file.All the function are prototyped in
these header files like stdio.h,string.h,math.h etc

8.What is the purpose of three expressions in FOR loop?

ANS:

 Initialization expression sets the initial value of the loop control variable
which acts as a counter that controls the loop.
 The condition Expression is a condition that determines whether the loop
will repeat or not.
 The update expression defines the number by which the loop control
variable will change each time the loop repeated.

9.Write difference between IF statement and IF….ELSE statement.

ANS:
BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 6
IF statement IF..ELSE statement
 IF statement tests a particular  IF ELSE statement decides
condition which of two actions to be
 If the condition is true a performed . If the condition is
statement or a set of statement true, the statement after if will
is executed otherwise control be executed otherwise the
will go to next statement statement after else will be
executed.

BHPS/EMP258/LESSON-3/VII/COMPUTER SCIENCE 2023-‘24 Page 7

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy