KENDRIYA VIDYALYA CLRI COMPUTER SCIENCE XII WORKSHEET ON OUTPUT QUESTIONS

Similar documents
QUESTION BANK SUB: COMPUTER SCIENCE(083)


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

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

(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

ASSIGNMENT CLASS : XII ( ) COMPUTER SCIENCE

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

CLASS: XII COM.SCIENCE

CLASS-XI COMPUTER SCIENCE

ENGLISH HOLIDAYS HOMEWORK CUM PROJECT WORK MAY-JUNE

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

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

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

KENDRIYA VIDAYALAYA PANGODE MONTHLY TEST AUGUST 2015

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

COMPUTER SCIENCE (083)

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

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

DELHI PUBLIC SCHOOL TAPI

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

Sample Paper Class XI Subject Computer Sience UNIT TEST II

ITL Public School First Term( )

KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION FIRST COMMON PRE BOARD EXAMINATION

(d) Rewrite the following program after removing all the syntax error(s), if any. [2] include <iostream.h> void main ( )

CHAPTER 4 FUNCTIONS. 4.1 Introduction

LAB7 : Characters and Strings

Computer Science XII Important Concepts for CBSE Examination Questions

Pointers, Dynamic Data, and Reference Types

Sample Paper 2012 Class XII Subject COMPUTER SCIENCE (Theory)


COMPUTER SCIENCE(083) SAMPLE QUESTION PAPER CLASS XII

C++ Final Exam 2017/2018

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 }

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

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

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; }

BRAIN INTERNATIONAL SCHOOL Term-II Class-XI Sub:- Computer Science Revision Sheet

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

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:

Downloaded from

COMPUTER SCIENCE (083)

3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition)

CMPS 221 Sample Final

Review of Arrays, Pointers, and References

Functions. Introduction :

Exam 3 Chapters 7 & 9

ASSIGNMENT CLASS-11 COMPUTER SCIENCE [C++]

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

m) sin() n) endl o) getch() p) cout

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:

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

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

KENDRIYA VIDYALAYA SANGATHAN, GUWAHATI REGION HALF-YEARLY EXAMINATION-2015 CLASS XI : COMPUTER SCIENCE Time Allotted : 3 hrs. Max.

I Mid Semester May 2012 : Class XII : Computer Science Max Mark 50 : Time 2 Hrs. 1. a) What is macro in C++? Give example 2

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

Object Oriented Pragramming (22316)

1 Marks Questions along with answers Topic: Programming in C++


void main() { int global=7 ; func( ::global,global) ; cout<<global<<, <<::global<< \n ; func(global,::global) ; cout<<global<<, <<::global<< \n ; }

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

Sample Paper - II Subject Computer Science

Subject: Fundamental of Computer Programming 2068

KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOME WORK XII COMPUTER SCIENCE ARRAY AND STRUCTURES

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

CSCE Practice Midterm. Data Types

Lecture 4. 1 Statements: 2 Getting Started with C++: LESSON FOUR

A function is a named group of statements developed to solve a sub-problem and returns a value to other functions when it is called.

b) Give the output of the following program: 6,70,70 2,70 210,282,59290

Downloaded from

1 Pointer Concepts. 1.1 Pointer Examples

Apllications. February 23, Indian Institute of Space Science and Technology. MA122 - Computer Programming and. Apllications. pointers and const

Programming in C++ (Educational Support)

Strings and Library Functions

UNIT-4 Statements:- Null Statement:- Compound Statement :- Statement Flow Control:- Sequence Construct:- Selection Construct

Programming in C++: Assignment Week 3

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

Downloaded from

Chapter 1. Computer Overview

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

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

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

CSCE Practice Midterm. Data Types

a) (5 points) What is the output of the following code sequence? int *ptr = 0x1050; printf ("%x\n", ptr--); printf ("%x\n", ptr);

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

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1

C++ ARRAYS POINTERS POINTER ARITHMETIC. Problem Solving with Computers-I

C++ for Java Programmers

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

#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); }

CLASS XII GUESS PAPER COMPUTER SCENCE (083)

FORM 2 (Please put your name and form # on the scantron!!!!)

3. Functions. Modular programming is the dividing of the entire problem into small sub problems that can be solved by writing separate programs.

VIDYA BHARATI SCHOOL

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:

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

Programming in C++: Assignment Week 1

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)

VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS

Transcription:

KENDRIYA VIDYALYA CLRI COMPUTER SCIENCE XII WORKSHEET ON OUTPUT QUESTIONS 1. What will be the output of following: void main ( ) int val = 10; cout << val ++ << val << ++ val; 2. Given the following code fragment: int ch = 20; cout << ch << ++ ch << ch << \n ; (i) The output of the code fragment. (ii) What is the effect of replacing ++ ch with ch + 1? 3. Give output: int global = 20; void fun (int &x, int y) x = x y; y = x * 10; cout << x <<, << y << \n ; int global = 8; fun (:: global, global); cout << global <<, << :: global << \n ; fun (global, :: global); cout << global <<, << :: global << \n ; 4. Give output: int fun ( int &a, int b = 0)

if (a % b = = 0) return ++ a; return b - - ; int x = 20, y = 23; y = fun (x, y); cout << x <<, << y << \n ; x = fun (y); cout << x <<, << y << \n ; y = fun (x); cout << x <<, << y << \n ; 5. Find output void fun (int &A, int &B) A = A + B; B = A B; A = A B; void main ( ) int a = 4, b = 18; fun (a, b); cout << a <<, << b; 6. Give output: void Change (int x[4]. int i) x[i] = x[i] * I; void main ( ) int x[ ] = 11, 21, 31, 41; for (int i = 0; i < 4; i++)

Change (x, i); cout << x[i] << \n ; 7. Rewrite the following codes after removing errors, if any, in the following snippet. Explain each error. int x[5], *y, z[5] for (i = 0; i < 5; i ++ x[i] = i; z[i] = i + 3; y = z; x = y; 8. Rewrite the following codes after removing errors, if any, in the following snippet. Explain each error. const int i = 20; const int * const ptr = &i; (*ptr)++; int j = 15; ptr = &j; 9. Give the output of the following program: char *p = Difficult ; char c; c = ++ *p ++; printf ( %c,c);

10. Give the output of the following program: int x [] = 10, 20, 30, 40, 50: int *p, **q, *t; p = x; t = x + 1; q = &t; cout << *p <<, << **q <<, << *t++; 11. In the following program, if the value of N given by the user is 20, what maximum and minimum value the program could possibly display ()? #include<stdlib.h> int N, Guessme; randomize(); cin>>n; Guessme = random(n-10) + 10 ; cout<<guessme<<endl; 12. Rewrite the following program after removing the error(s), if any. Underline each correction. #include <iostream.h> int x, sum =0; cin>>n; for (x=1;x<100, x+=2) if x%2=0 sum+=x; cout<< sum= >>sum; 13. What will be the output of the following program? #include <iostream.h>

int A[5] =0, 3, 4, 2, 1; int b[5]= 0; int n =4; P a g e 12 for ( int i=0; i<5;++i) b[a[i]]=a[i]; cout<< b[0]<<b[1]<<b[2]<<b[3<<b[4]; 14. What will be the output of the following program int var1=5,var2=10; for(int i=1;i<=2;i++) cout << var1++ << \t << --var2<< endl; cout << var2-- << \t << ++var1<< endl; 15. Find the output of the following program void main( ) long NUM = 1234543; int F = 0, S = 0; do int R = NUM% 10; if (R % 2!=0) F+ =R; S+ = R; NUM/=10; while(num>0); cout<<f-s;

16. Find the output of the following program: long Number = 7583241; int First=0, Second=0; do int R=Number%10; if (R%2==0) First+=R; Second+=R; Number /=10; while (Number > 0); cout<<first-second; 17. Rewrite the following program after removing the syntactical error(s), if any Underline each correction: #include <iostream.h> void main( ) struct TV char Manu_name[20]; char Tv_Type; int Price = 17000; New Tv; gets(manu_name); gets(tv_type); 18. Write the output of the following program: class Test int a, b; public: void set( int I, int j) a = I; b = j; void show() cout << a << << b << endl;

; Test t1, t2; T1.set(10,4); t2 = t1; t1.show() t2.show() 19. Give output of following code fragment: int val, res, n = 1000; cin >> val; res = n + val > 1750? 400 : 200; cout << res; (a) if the input is 2000. (b) if the input is 1000. (c) if the input is 500. 20. What will be the output if input is: (i) a (ii) c (iii) d (iv) h (v) b char ch, out [10] = ; cin >> ch; switch (ch) case a : strcat(out, a ); case b : strcat(out, b ); case c : strcat(out, c ); break; case d : strcat(out, d ); break; default : strcat(out, Not abcd ); cout << out << endl; 21. Give output of following code fragment: char *msg = a ProFile ; for (int i = 0; i < strlen (msg); i++) if (islower(msg[i])) msg[i] = toupper (msg[i]);

if (isupper(msg[i])) if( i % 2!= 0) msg[i] = tolower (msg[i-1]); msg[i--]; cout << msg << endl; 22. Give output of following code fragment: 5char *msg = WELCOME ; for (int i = strlen (msg) - 1; I >= 0; i--) if (islower(msg[i])) msg[i] = toupper (msg[i]); if (isupper(msg[i])) if( i % 2!= 0) msg[i] = tolower (msg[i-1]); msg[i--]; cout << msg << endl; 5 Find output struct Box int Len, Bre, Hei; ; void Dimension(Box B) cout << B.Len << X << B.Bre << X ; cout << B.Hei << endl; void main ( ) Box B1 = 10, 20, 8, B2, B3; ++B1.Hei; Dimension (B1); B3= B1; ++B3.Len; B3.Bre++; Dimension (B3); B2= B3; B2.Hei += 5;

B2.Len - = 2; Dimension (B2); 23. Give output int Execute( int M) if (M % 3 = 0) return M * 3; return M + 10; void output( int B = 2) for (int T = 0; T < B; T++) cout << Execute(T) << * ; cout << endl; output (4); output ( ); output (3); 24. Give the output of the following program: int ar[] = 2, 3, 4, 5; int *ptr = arr; int val = *ptr; cout << val << endl; val = *ptr ++; cout << val << endl; val = *ptr; cout << val << endl; val = * ++ptr; cout << val << endl; 25. Give the output of the following program: int ar[] = 2, 3, 4, 5;

int *ptr = arr; int val = *ptr; cout << val << endl; val = *ptr ++; cout << val << endl; val = *ptr; cout << val << endl; val = * ++ptr; cout << val << endl; 26. Give the output of the following program : struct point int x,y; ; void showpoint p) cout<<p.x<< : <<p.y<<endl; point u = 20,10,V,W; v=u; v.x+=20; w=v; u.y+=10; u.x+=5; w.x-=5; show(u); show(v); show(w); 27. Write the output of the following program : int calc(int u) if(u%2==0) return u+10; return u*2;

void pattern(char M, int B=2) for(int cnt=0;cnt<b;cnt++) cout<<calc(cnt)<<m; cout<<endl; pattern( * ); pattern( #,4); pattern( @,3); 28. Find the output of the following program: #include<conio.h> void ChangeContent(int Arr[], int Count) for(int C=1 ; C<Count ; C++) Arr[C-1]+=Arr[C] ; clrscr( ); int A[ ]=3, 4, 5, B[ ]=10,20,30,40, C[ ]=900, 1200, L ; ChangeContent(A,3); ChangeContent(B,4); ChangeContent(C,2); for(l=0 ; L<3 ; L++) cout<<a[l]<<"#"; cout<<endl; for(l=0 ; L<4 ; L++) cout<<b[l]<<"#" ; cout<<endl;

for(l=0 ; L<2 ; L++) cout<<c[l]<<"#" ; getch(); 29. Find the output of the following program: #include<conio.h> struct Game char Magic[20]; int Score; ; clrscr(); Game M="Tiger", 500 ; char *Choice ; Choice = M.Magic; Choice[4]='P' ; Choice[2]='L' ; M.Score+=50; cout<<m.magic<<m.score<<endl; Game N= M; N.Score-=120 ; cout<<n.magic<<n.score<<endl; getch(); 30. Write the output of the following program: #include<string.h> #include<ctype.h> void convert (char str[], int len) for (int count =0; count <len; count++) if ( isupper(str[count]))

str[count]=tolower(str[count]); if ( islower(str[count])) str[count]=toupper(str[count]); if ( isdigit(str[count])) str[count]=str[count]+2; str[count]= # ; char text[]= AISSCE 2008@ ; int size =strlen(text); convert (text,size); cout<<text<<endl; for (int c =0, r=size-1; c<=size/2;c++, r--) char temp= text[c]; text [c]= text[r]; text[r]= temp; cout<< text << endl; 31. Give the output of the following program. #include < iostream.h > #include <conio.h > int a = 10; int main( ) void demo ( int &, int, int *); clrscr( ); int a = 20; demo ( ::a,a,&b); cout << ::a << \t << a << \t << b; void demo ( int &x, int y, int *z ) a += x; y *= a; *z = a+y; cout << x << \t << y << \t << *z << endl;

32. Write the output of the follwoing program segment char *NAME="ComPUteR"; for(int x=0;x<strlen(name);x++) if(islower(name[x])) NAME[x]=toupper(NAME[x]); if(isupper(name[x])) if(x%2==0) NAME[x]=tolower(NAME[x])); NAME[X]=NAME[x-1]; puts(name); 33. 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) = toupper(*(ptr+counter)); clrscr(); int position = 0; char message[]= Mouse Fun ; changestring(message,position); cout<<message<< @ <<position;

34. 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) = toupper(*(ptr+counter)); clrscr(); int position = 0; char message[]= Pointer Fun ; changestring(message, position); cout<<message<< @ <<position;