QUESTION BANK SUB: COMPUTER SCIENCE(083)

Similar documents
KENDRIYA VIDYALYA CLRI COMPUTER SCIENCE XII WORKSHEET ON OUTPUT QUESTIONS

POINTERS. Pointer is a memory variable which can store address of an object of specified data type. For example:

(4) Find the syntax error(s), if any, in the following program: #include main() int x[5],*y,z[5]; for(i=0;i<5;i++) x[i]=i; z[i]=i+3; y=z; x=y; (5) Rew

Computer Science, Class XII ( ) (Summer Vacation-2015) (Holiday H.W) Chapter No.1 to 3

Guru Gobind Singh Public School Sector: V/B, Bokaro Steel City Assignment (Level 2)

What is Pointer? Pointer is a variable that holds a memory address, usually location of another variable.

KENDRIYA VIDAYALAYA PANGODE MONTHLY TEST AUGUST 2015


DATA FILE HANDLING. The function should create another file OUT.TXT with the text

Downloaded from

Sample Paper, 2015 Subject: Computer Science Class 12 th

include<iostream.h> #define PI=3.14 void main( ) { float r;a; cout<< enter any radius ; cin>>r; a=pi*pow(r,2); cout<< Area= <<a }

Downloaded from 1 Mark Questions Programming in C++

ITL Public School First Term( )

Chapter-13 USER DEFINED FUNCTIONS

Sample Paper Class XI Subject Computer Sience UNIT TEST II

Kapi ap l S e S hgal P T C p t u er. r S. c S ienc n e A n A k n leshw h ar ar Guj u arat C C h - 8

DELHI PUBLIC SCHOOL TAPI

Mock Test Paper-2. CBSE XII : Computer Science. Duration : 3hrs Max Marks : 70

CLASS-XI COMPUTER SCIENCE

Assignment-I. Date of Submission: (Computer Science)

MEMORY ADDRESS _ REPRESENTATION OF BYTES AND ITS ADDRESSES

PRINCE PUBLIC SCHOOL PRE-BOARD EXAMINATION ( ) SAMPLE PAPER-1 COMPUTER SCIENCE XII TIME ALLOWED: 3 HOURS

COMPUTER SCIENCE (083)

LAB 4.1 Relational Operators and the if Statement

Guru Gobind Singh Public School Sector: V/B, Bokaro Steel City Assignment

BLUE PRINT SUBJECT: - COMPUTER SCIENCE(083) CLASS-XI. Unit Wise Marks

CS31 Discussion 1E Spring 17 : week 08

(b) Name the header files for the following inbuilt functions. 1 (i) random() (ii) exit() Ans: (i) stdlib.h (ii) process.h/ stdlib.

Pointer Arithmetic. Lecture 4 Chapter 10. Robb T. Koether. Hampden-Sydney College. Wed, Jan 25, 2017

Functions. Introduction :

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.

ASSIGNMENT CLASS : XII ( ) COMPUTER SCIENCE

1. a) Find the correct identifiers out of the following, which can be 2 used for naming Variable, Constants or Functions in a C++ program:

C++ Final Exam 2017/2018

DELHI PUBLIC SCHOOL BOKARO STEEL CITY ASSIGNMENT FOR THE SESSION

KENDRIYA VIDYALAYA NO.1 SAGAR XII-COMPUTER SCIENCE ( ) HOMEWORK SUMMER VACATION

BRAIN INTERNATIONAL SCHOOL. Term-I Class XI Sub: Computer Science Revision Worksheet

ASSIGNMENT CLASS-11 COMPUTER SCIENCE [C++]

Homework Assignment #1

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:

KendriyaVidyalayaSangathan Kolkata Region

Computer Science XII Important Concepts for CBSE Examination Questions

BEng (Hons) Electronic Engineering. Resit Examinations for / Semester 1

Home Assignment for Class XII(Summer Vacation) Subject: CS Based on Library Functions ( 1 Mark)

Structured Data. CIS 15 : Spring 2007

Philadelphia University Faculty of Engineering Department of Computer Engineering Programming Language (630263)

COMPUTER SCIENCE (083)

Pointers and Strings Chapters 10, Pointers and Arrays (10.3) 3.2 Pointers and Arrays (10.3) An array of ints can be declared as

C++ 8. Constructors and Destructors

Guru Gobind Singh Public School Sector : V/B, Bokaro Steel City

C-Refresher: Session 06 Pointers and Arrays

1. Answer the following : a) What do you mean by Open Source Software. Give an example. (2)

VIDYA BHARATI SCHOOL

SRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS

CBSE Sample Paper 2015 Computer Science C++ Class XII Time 3hrs M.M 70

HOLIDAYS HOMEWORK CLASS : XII. Subject : Computer Science

THE INDIAN COMMUNITY SCHOOL, KUWAIT

Write the names of the header files to which the following belong :


Exam 3 Chapters 7 & 9

BHARATIYA VIDYA BHAVAN S V.M.PUBLIC SCHOOL, VADODARA. Class : XII SAMPLE PAPER Max Marks : 70

a data type is Types

Pointers, Dynamic Data, and Reference Types

Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

CSE202-Lec#4. CSE202 C++ Programming

COMPUTER SCIENCE 1998 (Delhi Board)

Review of Arrays, Pointers, and References

CSCI 101L - Data Structures. Practice problems for Final Exam. Instructor: Prof Tejada

CHAPTER 4 FUNCTIONS. 4.1 Introduction

THE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED.

SAMPLE PAPER 2015 SUB - COMPUTER SCIENCE - (Theory) CLASS XII Time allowed: 3 hours Maximum marks: 70

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

16. What is the significance of the break statement in a switch block?

SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION MAX MARKS:70 CODE - A DURATION : 3 Hours

Code No. 91. (i) All questions are compuls9ry. 1. (a) What is the difference between Type Casting and Automatic Type

KENDRIYA VIDYALAYA PANGODE MONTHLY TEST I JUNE 2015 CLASS XII COMPUTER SCIENCE Time allowed: 1 1/2 Hours Max. Marks: 50

Sample Paper 2013 SUB: COMPUTER SCIENCE GRADE XII TIME: 3 Hrs Marks: 70

KENDRIYA VIDYALAYA NO.02 AFS HINDAN G.BAD Holiday Homework Class XII Computer Science

(a) Differentiate between a call by value and call by reference method.

Sample Paper COMPUTER SCIENCE (Theory) Class-XII Time Allowed: 3hours Maximum Marks: 70

EAS 230 Fall 2002 Section B

pointers + memory double x; string a; int x; main overhead int y; main overhead

Container Class and Integrators, Proxy Class EC6301-OOPS AND DATA STRUCTURES

AUTUMN BREAK HOLIDAY HOMEWORK

Pointers. Lecture 1 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 14, 2015

CMPS 221 Sample Final

Sample Paper - II Subject Computer Science

CLASS XII SECOND TERM EXAMINATION SUBJECT : COMPUTER SCIENCE SET A2 (SOLUTIONS)

Kapil Sehgal PGT Computer. Science Ankleshwar Gujarat

Somany Vidyapeeth, Masani, Rewari

Data Structures and Algorithms

9.2 Pointer Variables. Pointer Variables CS Pointer Variables. Pointer Variables. 9.1 Getting the Address of a. Variable

Programming in C++: Assignment Week 3

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer:

IS0020 Program Design and Software Tools Midterm, Fall, 2004

Rich Harvest Public School Holiday Homework Session: Class -XII

Set I Sample Paper Class XI Subject Computer Science Time: 3Hours Maximum Marks: 70 Note. (i) All questions are compulsory.

b) #include<iostream.h> void main() { int a, b; cout<<"input two integer values? "; cin>>a>>b; double avg=(a+b)/2.0; cout<<"average="<<avg<<endl; }

JB Academy, Faizabad Half Yearly Examination Subject: Computer Science (083) Class XII

Transcription:

BHARATIYA VIDYA BHAVAN S V M PUBLIC SCHOOL, VADODARA QUESTION BANK SUB: COMPUTER SCIENCE(083) CHAPTER 6 Pointers 2 MARKS QUESTION 1. Rewrite the following codes after removing errors, if any, in the following snippet. Explain each error. void int x[5], *y, z[5] for (i = 0; i < 5; i ++) x[i] = i; z[i] = i + 3; y = z; x = y; 2. Rewrite the following program after removing the syntactical errors (if any). Underline each correction. void main() char arr = 12, 23, 34, 45; int ptr = arr; int val = *ptr; cout << *val << endl; val = *ptr++; cout << val << endl; val = *ptr : cout << val >> endl; val = *++ptr; cout << val << endl; 3. Identify the errors if any. Also give the reason for errors. void main() const int i =20; const int * ptr=&i; (*ptr)++; int j=15; ptr =&j; 4. Identify the errors if any. Also give the reason for errors. void main() const int i =20; const int * const ptr=&i; (*ptr)++; int j=15; ptr =&j; 5. Identify errors on the following code segment float c[ ] = 1.2,2.2,3.2,56.2; float *k,*g; k=c; g=k+4; k=k*2; g=g/2; cout<< *k= <<*k<< *g= << *g;

6. Identify the errors if any. Also give the reason for errors. void main() const int i =20; const int * ptr=&i; (*ptr)++; int j=15; ptr =&j; 7. Identify the errors if any. Also give the reason for errors. void main() const int i =20; const int * const ptr=&i; (*ptr)++; int j=15; ptr =&j; 8. Identify errors on the following code segment float c[ ] = 1.2,2.2,3.2,56.2; float *k,*g; k=c; g=k+4; k=k*2; g=g/2; cout<< *k= <<*k<< *g= <<*g; 3 Marks Questions 1. # Predict the output of the following code: # include<iostream.h> #include<conio.h> void main() int arr[] = 12, 23, 34, 45; int *ptr = arr; int val = *ptr; cout << val << endl; val = *ptr++; cout << val << endl; val = *ptr; cout << val << endl; val = *++ptr; cout << val << endl; 2. Find the output of the following code. main() int arr[] = 12, 23, 34, 45; int *ptr = arr; int val = *ptr; cout << val << endl; val = *ptr++; cout << val << endl; val = *ptr; cout << val << endl; val = *++ptr; cout << val << endl; val = ++*ptr; cout << val << endl;

3. main() int arr[] = 12, 23, 34, 45; int *ptr = arr; int val = *ptr; cout << val << endl; val = (*ptr)++; cout << val << endl; val = *ptr; cout << val << endl; val = *++ptr; cout << val << endl; 4. main() int arr[] = 2, 33, 44, 55; int *ptr = arr; int val = *ptr; cout << val << endl; val = *++ptr ; cout << val << endl; val = *ptr; cout << val << endl; val = * ptr++; cout << val << endl; 5. Write the output of the following program: #include<conio.h> clrscr( ); int a =32; int *ptr = &a; char ch = A ; char *cho=&ch; cho+=a; // it is simply adding the addresses. *ptr + = ch; cout<< a << <<ch<<endl; 6. Write the output of the following program: clrscr( ); int a =32; int *ptr = &a; char ch = A ; char *cho=&ch; *cho+=a; // it is adding the values. cout<< a << <<ch<<endl;

7. Write the output of the following program: clrscr( ); int a =32; int *ptr = &a; char ch = 'A'; char *cho=&ch; *cho+=a; *ptr += ch; cout<< a << "" <<ch<<endl; 8. Write the output of the following program: #include<conio.h> int a =3; void demo(int &x, int y, int *z) a+= x; y*=a; *z = a+y; cout<< a << << x << <<y << <<z <<endl; void clrscr( ); int a = 2, b =5; demo(::a,a, &b); cout<< ::a<< <<a<< << b<<endl; 9. Find the ouptput of the following : #include<conio.h> #include<stdio.h> #include<string.h> #include<ctype.h> char *Name= IntRAneT ; for(int x =0; x<strlen(name); x++) if(islower(name[x]) ) Name[x]=toupper(Name[x] ); else if(isupper(name[x]) ) if (x%2 = =0) Name[x]=tolower(Name[x]); else Name[x]=Name[x-1]; puts(name); 10. Give the output of the following program: void main() int x [] = 10, 20, 30, 40, 50; int *p, **q, *t; p = x; t = x + 1; q = &t; cout << *p << \t << **q << \t << *t++;

11. What will be the output of the program( Assume all necessary header files are included) : void print (char * p ) p = "pass"; cout<<"value is "<<p<<endl; char * x = "Best of luck"; print(x); cout<<"new value is "<<x<<endl; 12. What will be the output of the following program #include<ctype.h> #include<conio.h> #include<string.h> void changestring(char text[], int &counter) char *ptr = text; int length=strlen(text); for(;counter<length-2;counter+=2, ptr++) *(ptr+counter) = tolower(*(ptr+counter)); void main() clrscr(); int position = 0; char message[]= POINTERS FUN ; changestring(message, position); cout<<message<< @ <<position; 13. Find the output of the following program : void main() int Numbers[] = 2,4,8,10; int *ptr = Numbers; for (int C = 0; C<3; C++) cout<< *ptr << @ ; ptr++; cout<<endl; for(c = 0; C<4; C++) (*ptr)*=2; --ptr; for(c = 0; C<4; C++) cout<< Numbers [C]<< # ; cout<<endl; 14. What is the output of the following program if all the necessary header files have been included: char *Name= a ProFile ; for(int x =0; x<strlen(name); x++) if(islower(name[x]) ) Name[x]=toupper(Name[x] ); else if(isupper(name[x]) ) if (x%2!=0)

Name[x]=tolower(Name[x-1]); else Name[x]-- ; cout<<name<<endl; 15. Find the output of the following program: void main() int A[]=10,20,30,40,50; int *p=a; while(*p<30) if(*p%3!=0) *p = *p+2; else *p=*p+1; *p++; for(int J=0;J<=4;J++) cout<<a[j]<< "@"; if(j%3 == 0) cout<<endl; cout<<a[4]*3<<endl; 16. Find the output of the following code. #include<conio.h> clrscr( ); int a =32; int *ptr = &a; char ch = 'D'; char *cho=&c h; *cho+=a; *ptr += ch; *ptr *= 3; ch=ch- 30; cout<< a << "" <<-- ch<<endl; 17. Give the output of the following program. char *p="difficult"; char c; c=*p++;

cout<<c<<c++<<++c<<"\n"; char d =c+1; cout<<d++<<"\n"; cout<<d<<"\n"; cout<<*p; 18. What is THIS pointer? Explain with example. 19. What is a self-referential structure? Give example.