Similar documents

KENDRIYA VIDYALYA CLRI COMPUTER SCIENCE XII WORKSHEET ON OUTPUT QUESTIONS

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

ENGLISH HOLIDAYS HOMEWORK CUM PROJECT WORK MAY-JUNE

(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

(1)Given a binary file PHONE.DAT, containing records of the following structure type class Phonlist { char Name[20]; char Address[30]; char

Introduction to Computer Architecture

DELHI PUBLIC SCHOOL BOKARO STEEL CITY ASSIGNMENT FOR THE SESSION

ISC 2006 COMPUTER SCIENCE PAPER 1 THEORY PART I Answer all questions in this part

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

Experiment 3: Logic Simplification

ISC 2007 COMPUTER SCIENCE PAPER 1 THEORY PART I Answer all questions in this part

KENDRIYA VIDYALYA CLRI CHENNAI AUTUMN BREAK HOLIDAY HW MARKS QUESTIONS : DATA STRUCTURE

SAMPLE PAPER. Class: XII SUBJECT COMPUTER SCIENCE. Time: 3 Hours MM: 70

COMPUTER SCIENCE 2002 (Delhi Board)

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

Code No. 083 Time allowed: 3 hours Maximum Marks: 70 Instructions: (i) All questions are compulsory. (ii) Programming language: C++

Unit-IV Boolean Algebra

CLASS: XII COM.SCIENCE

X Y Z F=X+Y+Z

DKT 122/3 DIGITAL SYSTEM 1

BOOLEAN ALGEBRA. 1. State & Verify Laws by using :

QUESTION BANK SUB: COMPUTER SCIENCE(083)

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

Code No: R Set No. 1

Module -7. Karnaugh Maps

KE DRIYA VIDYALAYA SA GATHA,CHE AI REGIO. COMMO PRE-BOARD EXAMI ATIO COMPUTER SCIE CE CLASS- XII Time allowed : 3 hours Maximum Marks : 70

Chapter 2 Boolean algebra and Logic Gates


UNIT-4 BOOLEAN LOGIC. NOT Operator Operates on single variable. It gives the complement value of variable.

CLASS XII COMPUTER SCIENCE(083) TimeAllowed : 3 HrsMax Marks : 70

void Add() { cin >> trainnumber; gets(trainname); } void display() { cout<<trainnumber <<":"<<TrainName<<end;

DELHI PUBLIC SCHOOL BOKARO STEEL CITY

ENGINEERS ACADEMY. 7. Given Boolean theorem. (a) A B A C B C A B A C. (b) AB AC BC AB BC. (c) AB AC BC A B A C B C.

ISC 2011 COMPUTER SCIENCE PAPER 1 THEORY

Philadelphia University Faculty of Information Technology Department of Computer Science. Computer Logic Design. By Dareen Hamoudeh.

COMPUTER APPLICATION

PART I. Answer all questions in this Part. While answering questions in this Part, indicate briefly your working and reasoning, wherever required.

Experiment 4 Boolean Functions Implementation

Code No: R Set No. 1

CMPE223/CMSE222 Digital Logic

KENDRIYA VIDYALAYA SANGATHAN, COMPUTER SCIENCE (THEORY) I PRE-BOARD TIME 3 HRS CLASS XII M. Marks 70

Code No: R Set No. 1

Mid-Term Exam Solutions

2.6 BOOLEAN FUNCTIONS

Computer Science. Unit-4: Introduction to Boolean Algebra

Guru Harkrishan Public School, Karol Bagh Pre Mock Class XII Sub: COMPUTER SCIENCE Allowed :3 hrs

CLASS XII GUESS PAPER COMPUTER SCENCE (083)

Chapter 3 Simplification of Boolean functions

ISC 2009 COMPUTER SCIENCE PAPER 1 THEORY PART I Answer all questions in this part

CS470: Computer Architecture. AMD Quad Core

CBSE GUESS PAPER. Roll No. Computer Sc. XII(083)/

Computer Science 2006 (Outside Delhi)

QUESTION BANK SUB: COMPUTER SCIENCE(083)

QUESTION BANK FOR TEST

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

ECE380 Digital Logic

Code No: 07A3EC03 Set No. 1

Downloaded from

KENDRIYA VIDYALAYA SANGATHAN BHUBANESWAR REGION SECOND PREBOARD EXAMINATION FOR CLASS XII SUBJECT: COMPUTER SCIENCE

Digital logic fundamentals. Question Bank. Unit I

GATE Exercises on Boolean Logic

To write Boolean functions in their standard Min and Max terms format. To simplify Boolean expressions using Karnaugh Map.

ISC SPECIMEN PAPER Computer Science Paper 1 (Theory) Part I Question 1. [ 2 x 5 = 10] Question 2. [ 2 x 5 = 10] Question 3.

Switching Theory & Logic Design/Digital Logic Design Question Bank

Assignment (3-6) Boolean Algebra and Logic Simplification - General Questions

COMPUTER SCIENCE (083)

R.M.D. ENGINEERING COLLEGE R.S.M. Nagar, Kavaraipettai

Gate Level Minimization Map Method

Computer programs are associated to work with files as it helps in storing data & information permanently. File - itself a bunch of bytes stored on

(d) Observe the following C++ code very carefully and rewrite it after removing any/all syntactical errors: [2] Include < iostream.

LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

COMPUTER SCIENCE Paper 1

2008 The McGraw-Hill Companies, Inc. All rights reserved.

1. Mark the correct statement(s)

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

SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road QUESTION BANK (DESCRIPTIVE)

After going through this lesson, you would be able to: store data in a file. access data record by record from the file. move pointer within the file

Computer Science[083]

Autumn Break 2017 Exam Oriented Assignment Class-XII B, Computer Science

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

Chapter 2. Boolean Expressions:

Chapter 3. Gate-Level Minimization. Outlines

5. (a) What is secondary storage? How does it differ from a primary storage? (b) Explain the functions of (i) cache memory (ii) Register

SAMPLE PAPER-2015 CLASS-XII COMPUTER SCIENCE. Sample paper-i. Time allowed: 3 hours Maximum Marks: 70 Name : Roll No.:

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY

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

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

KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION COMPUTER SCIENCE (083)

COMMON PRE-BOARD EXAMINATION COMPUTER SCIENCE

COMPUTER SCIENCE(083) SAMPLE QUESTION PAPER CLASS XII

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6302 DIGITAL ELECTRONICS

B.Tech II Year I Semester (R13) Regular Examinations December 2014 DIGITAL LOGIC DESIGN

ASSIGNMENT CLASS : XII ( ) COMPUTER SCIENCE

Specifying logic functions

BHARATHIDASAN ENGINEERING COLLEGE Degree / Branch : B.E./ECE Year / Sem : II/ III Sub.Code / Name : EC6302/DIGITAL ELECTRONICS

Combinational Logic & Circuits

10EC33: DIGITAL ELECTRONICS QUESTION BANK

KendriyaVidyalayaSangathan Kolkata Region

Gate-Level Minimization

Transcription:

If the function modify( ) is supposed to change the mark of a student having student_no y in the file student.dat, write the missing statements to modify the student record. 10. Observe the program segment carefully and answer the question that follows: class item int item_no; char item_name[20]; public: void enterdetail( ); void showdetail( ); int getitem_no( ) return item_no; ; void modify(item x ) fstream File; File.open( item.dat, ios::binary ios::in ios::out ) ; item i; while(file.read((char*) & i, sizeof (i)))//statement 1 if(x. getitem_no( ) = = i. getitem_no( )) File.seekp(File.tellg( ) sizeof(i)); File.write((char*) &x, sizeof (x)); File.close() ; If the function modify( ) modifies a record in the file item.dat with the values of item x passed as argument, rewrite statement 1 in the above code using ios::eof( ), so as to modify record at its proper place. 2 Marks Questions Programming in C++ 1. What is wrong with the following while loop: a. int counter = 1; b. int counter = 1; while ( counter < 100) while ( counter < 100) cout << counter << \n; cout << counter << \n; counter + +; counter - -; 2. What will be the output of following: void main ( ) int val = 10; cout << val ++ << val << ++ val; Page 8

3. 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? 4. Differentiate between the output of following code fragments: (i) int f = 1, i = 2; (ii) int f = 1, i = 2; while (++ i < 5) do f *= i; f *= i; cout << f; while (++ i < 5); cout << f; 5. 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 ; 6. Give output: int fun ( int &a, int b = 0) if (a % b = = 0) return ++ a; else 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 ; 7. Find output void fun (int &A, int &B) Page 9

A = A + B; B = A B; A = A B; void main ( ) int a = 4, b = 18; fun (a, b); cout << a <<, << b; 8. 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 ; 9. 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; 10. 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; Page 10

11. Give the output of the following program: char *p = Difficult ; char c; c = ++ *p ++; printf ( %c,c); 12. 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++; 13. 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; 14. 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; 15. 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; Page 11

for ( int i=0; i<5;++i) b[a[i]]=a[i]; cout<< b[0]<<b[1]<<b[2]<<b[3<<b[4]; 16. 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; 17. Find the output of the following program void main( ) long NUM = 1234543; int F = 0, S = 0; do int Rem = NUM% 10; if (Rem % 2!=0) F+ =R; else S+ = R; NUM/=10; while(num>0); cout<<f-s; 18. 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; else Second+=R; Number /=10; while (Number > 0); cout<<first-second; Page 12

19. 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); 20. Identify error in the following program segment: class ABC public: int read(); char display val(); private: int x; char ch; 21. 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() 22. Answer the questions after going through the following class class Exam int year; public: Exam(int y) year=y; //Constructor 1 Exam(Exam & t); //Constructor 2 ; i. Create an object, such that it invokes Constructor I. ii. Write complete definition for Constructor 2. Page 13

23. Answer the questions after going through the following class. class Exam char Subject[20] ; int Marks ; public : Exam() // Function 1 strcpy(subject, Computer ) ; Marks = 0 ; Exam(char P[ ]) // Function 2 strcpy(subject, P) ; Marks=0 ; Exam(int M) // Function 3 strcpy(subject, Computer ) ; Marks = M ; Exam(char P[ ], int M) // Function 4 strcpy(subject, P) ; Marks = M ; ; a) Which feature of the Object Oriented Programming is demonstrated using Function 1, Function2, Function 3 and Function 4 in the above class Exam? b) Write statements in C++ that would execute Function 3 and Function 4 of class Exam. 24. Rewrite the following program after removing all the syntax error(s), if any. Underline each correction. struct Pixels int Color, Style ; void ShowPoint(Pixels P) cout<<p.color,p.style<<endl; Pixels Point1 = (5,3); ShowPoint(Point 1); Pixels Point2 = Point1 Color.Point1+=2; Page 14

ShowPoint(Point2); 25. Write a function in C++ to count the number of uppercase alphabets present in a text file STORY.TXT. 26. Write a function in C++ to count the number of lowercase alphabets present in a text file STORY.TXT. 27. Write a function in C++ to count the number of alphabets present in a text file XY.TXT. 28. Write a user defined function in C++ to read the content of a text file JOKE.TXT, count and display the number of blank spaces present in it. 29. Write a function in C++ to count and display the number of lines starting with alphabet A in a text file MYFILE.TXT. 30. Write a function in C++ to print the count of the word and in the text file Myfile.txt. 31. Write a function in C++ to write the characters entered through the keyboard into the file myfile.txt, until a # character is entered. 32. Write a function in C++ to count the number of words present in the text file MyFile.txt. Assume that each word is separated by a blank space and no blank space appears in the beginning and at the end of the file. 33. Write a function in C++ to count and display the number of student records stored in the binary file Student,dat. Assume that student is a structure and 10 bytes of memory is required to store each student record. 34. How many stream objects would you need to manage the following situations: (a) To process three files sequentially. (b) To merge two sorted files into third file. 35. Observe the program segment carefully and answer the question that follows: class item int item_no; char item_name[20]; public: void enterdetail( ); void showdetail( ); int getitem_no( ) return item_no; ; void modify(item x ) fstream File; File.open( item.dat, ios::binary ios::in ios::out ) ; item i; while(file.read((char*) & i, sizeof (i))) if(x. getitem_no( ) = = i. getitem_no( )) File.seekp(File.tellg( ) sizeof(i)); File.write((char*) &x, sizeof (x)); Page 15

File.close( ) ; //Statement 1 The function modify( ) modifies a record in the file item.dat.state whether statement 1 is mandatory? Give explanation. 36. Write a function in C++ to calculate the average word size in the text file MyFile.txt. 37. Given the binary file STUDENT.DAT, containing the records of the following class: class student int roll_no; char name[20]; float percent; public: void getdata( ); void show( ); float returnpercent( ) return percent; ; Write a function BELOW75( ) in C++, that would count and display the records of those students whose score is below 75 percent. 38. Write a function which takes pointers to two strings as parameter and compare these strings. The function should return 1 if two strings are same otherwise return 0. 39. Give the output of the following program( Assume all necessary header files are included) : void main( ) char * x = teamindia ; char c; c = ++ *x ++; cout<<c; 40. Give the output of the following program(assume all necessary header files are included) : void main( ) char *x = teamindia ; char c; c = ( *(x+1) ) ++ ; cout<<c; 41. Give the output of the following program( Assume all necessary header files are included) : void main( ) Page 16

char * x = teamindia ; char c; c = ++( *(x+1) ); cout<<c; 42. 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; void main( ) char * x = "Best of luck"; print(x); cout<<"new value is "<<x<<endl; Data Structure: Array, Stack and Queue Convert the following infix expressions to postfix expressions 1. (((x*y a*b)-d/f)+a)*b 2. (a+(((b-(c*d-e)+f))/g))*(h-j) 3. A+B*(P+Q)^C/D 4. A+B-C*D+F-G 5. A^B-A/(B*(A-B-A*D)/B) 6. A+(((B-C)*(D-E)+F/G)^(H-J) 7. (A+B) *(C^(D-E)+F-G 8. A*(B+(C+D)*(E+F)/G)*H 9. A*(B+C)/D-E-(F+G/H) 10. A + B * C ^ D (E / F G) 11 A B + C * D ^ E * G / H 12 ((A+B)-((C_D)*E/F)*G 13 (TRUE && FALSE)! (FALSE TRUE) 14 (A + B * C ) / D + E / (F * G + H / I) 15 NOT A OR NOT B AND NOT C Evaluate the following postfix expression E given below, show the contents of the stack during the evaluation 16 E= 10,*,15,-,25,5,/,2+ 17 E= 7,6,2,^,*,18,+ Page 17

E= 5,9,+2,*,4,1,1,3,_,*,- 18 E= 120,45,20,+,25,15,-,+,* 19 TRUE FALSE TRUE FALSE NOT OR TRUE OR AND 20 E= 30,5,2,^,12,6,/,+,- 21 15, 3, 2, +, /, 7, + 2, * 22 25, 8, 3, -, / 6, *, 10 + 23 AB CD + E * + WHERE A = 5, B = 3, C = 5, D = 4 AND E = 2 24 7,6, +, 8, *, 2, -, 3, *, 2, 4, *, - 25 8, 7, +, 9, 8, +, -, 2, /, 3,4, * 2, / + 26 E= 5,20,15,-,*,25,2,*,+ 27 IF A=2,C=3,D=2,E=5,F=4,G=6 EFG^D*AC/- + Boolean Algebra 1 2 Minimize F(A,B,C) = A BC+AB C +AB C+AB+A B using Karnaugh Map 3 Minimize the 4 variable Boolean function F(A,B,C,D)= ABC D+A BCD+A B C+A B D +AC +A B C+B 4 Draw the circuit for the following function using NAND Gate F(A,B,C,D)=D(A+B(C+A )+B ) 5 Design (A+B).(C+D) using NOR Gate. 6 Simplify the following Boolean Expression using Boolean postulates and laws of Boolean Algebra. (a) E=xyz + x y+xyz (b) Z=(a +a).b.c+a.b.c +a.b.(c+c ) 7 Simplify the following Boolean Expression using Boolean postulates and laws of Boolean Algebra. X= a.b.c +a.b.c+a.b.c +a.b.c 8 Simplify the following Boolean Expression using Boolean postulates and laws of Boolean Algebra. F = (A+B +C+D ).(A +B +C+D).(A+B +C+D ).(A +B +C+D ).(A +B+C+D ) 9 Prove x.y +y.z = x.y.z +x.y.z+x.y.z+x.y.z algebraically. 10 A Boolean function F defined on three input variable X,Y,Z is 1 if and only if the number of 1(One) input is odd (e.g. F is 1 if X=1,Y=0,Z=0). Draw the truth table for the above function and express it in canonical sum of product form. 11 Draw the logic circuit diagram of the following expression using NOR Gate only P = (x +y +z )(x+y +z)(x+y+z ). 12 Check the validity of the following Boolean Expression: (y+z)(z+x)=(x +y )(x +z )(y +z ) 13 Prove that (a +b )(a +b)(a+b )=a b. 14 Simplify AB+(AC) +AB C(AB+C) algebraically. Page 18

15 Convert (A+B)(AB +AC)(A C +B C ) to SOP form. 16 Convert (A+B)(B +C)(A +C) to SOP Form. 17 Prove XY+YZ+Y Z=XY+Z algebraically. 18 Draw the Truth Table for XOR and XNOR Gate. 19 Prove that NAND and NOR Gate are universal gate. 20 Explain the Relation ship between minterms and maxterms. An Expression is given in SOP form F(x,y,z)=S(0,1,4,5) show its min terms and maxterms. 21 Represent (A +B +C )(A+B +C ) in NOR to NOR logic network. 22 Draw the simplified logic diagram using only NAND gates to implement the three input function f denoted by the expression (Not By using K Map) F= ( 0,1,2,5) 23 Express P+Q R in canonical SOP Form and POS Form. 24 Express the Boolean Function F(x,y,z) =xy+x z in a product of max term form. 25 Write the equivalent canonical Sum of Product expression for the following Product of Sum Expression F(X,Y,Z)= π (1,3,6,7) 26 A majority gate is a digital circuit whose output is equal to 1 if the majority of the inputs are 1. The output is 0 otherwise. By means of a truth table, find the Boolean expression implemented by 3 input majority gates. 27 An even parity gate is a digital circuit whose output is equal to 1 if the odd numbers of inputs are 1. The output is 0 otherwise. By means of a truth table (a) Find the Boolean function implemented by a 3 input odd parity gate. (b) Which single gate can be used to represent this circuit 3 Marks Questions Programming in C++ 1 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. 2 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 : case b : case c : case d : default : strcat(out, a ); strcat(out, b ); strcat(out, c ); break; strcat(out, d ); break; strcat(out, Not abcd ); Page 19