0% found this document useful (0 votes)
25 views3 pages

QUESTIONS

This document contains 8 two-mark questions and 8 three-mark questions from previous year's computer science exams. The two-mark questions test concepts like data types, loops, operators, and functions. The three-mark questions involve writing and analyzing short programs related to classes, inheritance, arrays, and loops. Overall, the document assesses fundamental programming concepts in C++.

Uploaded by

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

QUESTIONS

This document contains 8 two-mark questions and 8 three-mark questions from previous year's computer science exams. The two-mark questions test concepts like data types, loops, operators, and functions. The three-mark questions involve writing and analyzing short programs related to classes, inheritance, arrays, and loops. Overall, the document assesses fundamental programming concepts in C++.

Uploaded by

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

COMPULSORY QUESTIONS WITH ANSWERS

STD: XI COMPUTER SCIENCE


TWO MARKS (PUBLIC QUESTIONS) (q.no 24)
1. Convert the following if-else statement into conditional statement (J-2023)
if (marks > = 60) Answer: Grade = (marks > = 60)? A:B;
Grade = ‘A’;
else
Grade = ‘B’;
2. Write the output for the following: (M-2023) Output
#include<iostream> 87.2525
using namespace std; 87
int main ()
{
Double var1=87.25255;
cout<<(float)var1<<end1; cout<<(int)var1<<end1; }
3. What is an instruction set? (Aug-2022)
Basic set of machine level instructions that a microprocessor is designed to execute is called as an instruction set.
4. What are importance of void data type? (M-2022)
❖ To indicate the function does not return a value
❖ To declare a generic pointer
5. for (int m=1;m<=9,M+=2) cout<<m; (S-2020)
1) How many times the loop will be executed? 8 times
2) Write the output of the above snippet. 1 to 10
6. If a = 65 , b= 15 then find (M-2020)
a=65, b=15
(i) a&b
8bits Binary value of 65 ➔ 0100 0001 8bits Binary value of 15 ➔ 0000 1111
8bits Binary value of a&b ➔ 0000 0001 ➔ 110
(ii) a^b
8bits Binary value of 65 ➔ 0100 0001 8bits Binary value of 15 ➔ 0000 1111
8bits Binary value of a^b ➔ 0100 1110 ➔ 7810
7. Write down the importance of destructor. (J-2019)
❖ The purpose of the destructor is to free the resources that the object may have acquired during its lifetime .
❖ A destructor function removes the memory of an object which was allocated by the constructor at the
time of creating a object.
8. Write a while loop that displays numbers 5, 10, 15, .......50. (M-2019)
int i=5;
while (i<=50)
{
cout << i<<’,’ ;
i+=5;
}
THREE MARKS (PUBLIC QUESTIONS) (q.no 33)
1. Convert the following into octal number into binary number. (J-2023)
i) 6137
6 1 3 7 6127 = (110001011111)2
110 001 011 111

ii) 245
2 4 5 245 = (010100101)2
010 100 101

iii) 472
4 7 2 472 = (100111010)2
100 111 010

1
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
2. Write a C++ program to display numbers from 1 to 10. Except 5 using ‘for’ and ‘continue’ Statement. (M-2023)
#include<iostream>
using namespace std; Output:
int main() 1,2,3.4,6,7,8,9,10
{
int i;
for(i=1;i<=10;i++)
{
if(i==5)
{
continue;
}
cout<<i<<"\n";
}
return 0;
}
3. What is meant by computer ethics? (Aug-2022)
❖ Computer ethics deals with the procedures, values and practices that govern the process of consuming computer
technology and its related disciplines without damaging or violating the moral values and beliefs of any
individual, organization or entity.
❖ It is a set of moral principles that rule the behaviour of individuals who use computers.
❖ An individual gains knowledge to follow the right behaviour, using morals that are also known as ethics.
4. Write a c++ program to sum the numbers from 1 to 10 using ‘for’ loop. (M-2022)
#include <iostream> Output
using namespace std; The sum of 1 to 10 is 55
int main ()
{
int i,sum=0;
for(i=1; i<=10;i++)
{
sum=sum+i;
}
cout<<"The sum of 1 to 10 is "<<sum;
return 0;
}
5. Consider the following c ++ code and answer the questions S-2020
class Personal 1 Which type of Inheritance is shown in the program?
{ Multilevel inheritance
int admno,rno; 2 Specify the visibility mode of base classes.
Marks – Public visibility mode Personal- Private visibility mode.
protected: 3.Name the base class(/es) and derived class (/es).
char Name[20]; Base Class Personal Derived Class Marks and Result
public:
personal();
void pentry();
void Pdisplay(); };
class Marks:private Personal
{ int M
protected:
char Grade[5];
public:
Marks();
void Mentry();
void Mdisplay(); };
class Result:public Marks
{
float Total,Agg;
char remark[5];
result();
void Rcalculate(); void Rdisplay();

2
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)
6. Read the following C++ code and answer the questions given below. (M-2020)
#include<iomanip> QUESTIONS
#include<iostream> 1.What is the name of the class in the above program?
using namespace std; Answer: product
class product 2. What are the data members are the class?
{ Answer: code, quantity, price
int code, quantity;
float price; 3. What is the memory size of the objects p1,p2?
public: Answer: Memory allocation for object p1 12
void assigndata(); Memory allocation for object p2 12
void print();
int main()
{
product p1,p2;
cout<<”\n Memory allocation for object p1”<<sizeof(p1);
cout<<”\n Memory allocation for object p2”<<sizeof(p2);
return 0;
}
7. Write a short program to print following series: 1 3 5 7…75 (J-2019)
#include<iostream>
using namespace std;
int main() Output:
{ 1 3 5 7 9 11 13 15 …..75
int n;
for(int i=1;i<=75,i+=2)
cout<<i<< “\t”;
getch ( );
}
8. Read the following C++ code and answer the questions given below. (M-2019)
class student Questions:
{ 1) Identify the member of the class : m,n, add(), calc()
int m,n;
public: 2) What is size of the objects x1,x2 in memory? x1 =8 bytes x2 = 8 bytes
void add();
float calc();
}x1,x2;

3
PREPARED BY…, B.MOHAMED YOUSUF M.C.A., B.Ed., (PG ASST IN COMPUTER SCIENCE)

You might also like