# Practical Question for Practice

List of Practical questions for COMP SCIENCE (083) AISCCE 2016-17

1 WAP to perform Insertion and deletion operation in queue.
2 WAP to perform PUSH and POP operation in Stack.
3 WAP to perform insert and delete operation in Linked List.
4 WAP to perform Binary Search using class.
5 WAP to perform selection sort using Class.
6 WAP to perform Bubble Sort using class.
7 WAP to count the total no of vowels in a file.
8 WAP to count the no of uppercase , lowercase , digits in a file.
9 WAP to create a backup of a file.
10 WAP to find the record of a student from file and print the record.
11 If F(a,b,c,d)=∑(0,1,3,4,5,7,8,9,11,13,15,),obtain a simplified form using K-Map
12 If F(a,b,c,d)=∑(0,1,3,4,5,7,8,9,11), obtain a simplified form using K-Map
13 If F(a,b,c,d)=∑(0,1,2,3,4,5,7,8,9,11,13,15),obtain a simplified form using K-Map
14 If F(a,b,c,d)=π(0,1,3,4,5,11,13,15,),obtain a simplified form using K-Map
15 If F(a,b,c,d)=π(0,1,3,4,5,7,8,9,11,13)obtain a simplified form using K-Map
SQL Commands

 Table: Employee No Name Salary Zone Age Grade Dept 1 Mukul 30000 West 28 A 10 2 Kritika 35000 Centre 30 A 10 3 Naveen 32000 West 40 NULL 20 4 Uday 38000 North 38 C 30 5 Nupur 32000 East 26 NULL 20 6 Moksh 37000 South 28 B 10 7 Shelly 36000 North 26 A 30

The command along with the result must be written in the answer sheet.

a.       Display the details of all the employees whose Grade is not NULL.

b.      Display the various department numbers from the table Employee. A department number should be displayed only once.

c.       Display the names and salaries of all the employees who are not working in department 20.

d.      Display the details of all the employees whose salary is between 32000 and 38000.

e.       Display the names of all the employees who are working in department 20 or 30. (Using IN operator)

Table Name : Employee

 Employee_id First_name Last_name Salary Joining_date Department 1 John Abraham 1000000 01-JAN-13 12.00.00 AM Banking 2 Michael Clarke 800000 01-JAN-13 12.00.00 AM Insurance 3 Roy Thomas 700000 01-FEB-13 12.00.00 AM Banking 4 Tom Jose 600000 01-FEB-13 12.00.00 AM Insurance 5 Jerry Pinto 650000 01-FEB-13 12.00.00 AM Insurance 6 Philip Mathew 750000 01-JAN-13 12.00.00 AM Services 7 TestName1 123 650000 01-JAN-13 12.00.00 AM Services 8 TestName2 Lname% 600000 01-FEB-13 12.00.00 AM Insurance

Table Name : Incentives

 Employee_ref_id Incentive_date Incentive_amount 1 01-FEB-13 5000 2 01-FEB-13 3000 3 01-FEB-13 4000 1 01-JAN-13 4500 2 01-JAN-13 3500
1. Get all employee details from the employee table

Select * from employee

2. Get First_Name,Last_Name from employee table

Select first_name, Last_Name from employee

3. Get First_Name from employee table using alias name “Employee Name”

Select first_name Employee Name from employee

4. Get First_Name from employee table in upper case

Select upper(FIRST_NAME) from EMPLOYEE

5. Get First_Name from employee table in lower case

Select lower(FIRST_NAME) from EMPLOYEE

6. Get unique DEPARTMENT from employee table

select distinct DEPARTMENT from EMPLOYEE

7. Select first 3 characters of FIRST_NAME from EMPLOYEE

Oracle Equivalent of SQL Server SUBSTRING is SUBSTR

Query : select substr(FIRST_NAME,0,3) from employee

SQL Server Equivalent of Oracle SUBSTR is SUBSTRING,

Query : select substring(FIRST_NAME,0,3) from employee

MySQL Server Equivalent of Oracle SUBSTR is SUBSTRING.

In MySQL start position is 1, Query : select substring(FIRST_NAME,1,3) from employee

8. Get position of ‘o’ in name ‘John’ from employee table

Oracle Equivalent of SQL Server CHARINDEX is INSTR,

Query : Select instr(FIRST_NAME,’o’) from employee where first_name=’John’

SQL Server Equivalent of Oracle INSTR is CHARINDEX,

Query: Select CHARINDEX(‘o’,FIRST_NAME,0) from employee where first_name=’John’

MySQL Server Equivalent of Oracle INSTR is LOCATE,

Query: Select LOCATE(‘o’,FIRST_NAME) from employee where first_name=’John’

9. Get FIRST_NAME from employee table after removing white spaces from right side

select RTRIM(FIRST_NAME) from employee

10. Get FIRST_NAME from employee table after removing white spaces from left side

select LTRIM(FIRST_NAME) from employee

11. Get length of FIRST_NAME from employee table

Oracle,MYSQL Equivalent of SQL Server Len is Length ,

Query :select length(FIRST_NAME) from employee
SQL Server Equivalent of Oracle,MYSQL Length is Len

Query :select len(FIRST_NAME) from employee

12. Get First_Name from employee table after replacing ‘o’ with ‘\$’

select REPLACE(FIRST_NAME,’o’,’\$’) from employee

13. Get First_Name and Last_Name as single column from employee table separated by a ‘_’

Oracle Equivalent of MySQL concat is ‘||’,

Query : Select FIRST_NAME|| ‘_’ ||LAST_NAME from EMPLOYEE

SQL Server Equivalent of MySQL concat is ‘+’,

Query : Select FIRST_NAME + ‘_’ +LAST_NAME from EMPLOYEE
MySQL Equivalent of Oracle ‘||’ is concat,

Query : Select concat(FIRST_NAME,’_’,LAST_NAME) from EMPLOYEE

14. Get FIRST_NAME ,Joining year,Joining Month and Joining Date from employee table

SQL Queries in Oracle,

Select FIRST_NAME, to_char(joining_date,’YYYY’) JoinYear , to_char(joining_date,’Mon’), to_char(joining_date,’dd’) from EMPLOYEE

SQL Queries in SQL Server, select SUBSTRING (convert(varchar,joining_date,103),7,4) , SUBSTRING (convert(varchar,joining_date,100),1,3) , SUBSTRING (convert(varchar,joining_date,100),5,2) from EMPLOYEE

SQL Queries in MySQL, select year(joining_date),month(joining_date), DAY(joining_date) from EMPLOYEE

VIVA QUESTIONS FOR AISSCE PRACTICAL 2016-17

1.Define program.

2.Define Programming language

3.Explain different stages of Programdevelopment

4.Whatialgorithm?

5.Classification of languages

6.Importance of main()

7.Difference between C and C++.

8.Features of OOPs

9.Difference between Object OrientedPrograms and Procedure OrientedPrograms.

10.Define Tokens.

11.Define Keywords

12.Identifiers (their characteristics)

13.Operators (Arithmetic, Relational,Logical, Ternary, Scope resolution,sizeof(), increment, decrement,indirection, at address)14.Difference between fundamental datatypes and derived data types

15.Fundamental data types, memorysize, range.16.Type casting

17.Data type modifiers – long, short,signed and unsigned etc.

18.Different types of execution –sequential, selection and iteration.

19.ASCII

20.Difference between prefix and postfix

21.Difference between global variablesand local variables.

22.Arithmetic assignment operators (+=,-=, *=, /=, %=)

23.Difference between entry-controlledloops and exit-controlled loops

24.Elements control a loop –initialisation expression, testexpression, body of the loop andupdate expression.

25.Nested loop

26.Difference between rvalue and lvalue

27.What is compilation?

28.What is debugging?

29.Different types of errors – compilationerror, run time error and logical error

30.What is an array?

31.Equation for finding total number of elements in an array (UB – LB + 1).

32.What is a matrix?

33.How can we find the address of anelement in a 2-D array?

1. What is the difference between rowmajor and column major form of anarray?

35.What is a string?

36.What is the importance of ‘\0’ in astring?

37.What are the criteria used for matrixaddition and multiplication?

38.What do you mean by diagonalelements of a matrix?

39.What is a symmetric matrix?

40.Which are the important stringhandling functions used in C++?(strcpy(), strlen(). strcmp(), strcat(),strrev())

41.Character functions used in C++(isalpha(), isdigit(), isalnum(),isupper(), islower(), toupper(),tolower())

42.What do you mean by scope of avariable?

43.What is a function?

44.What is function signature or functionprototype?

45.Difference between calling functionand called function?

46.Difference between actualparameters and formal parameters.

47.Difference between break andcontinue.

48.Importance of exit() function.

49.Difference between call by value andcall by reference method of functioncall.

50.Classification of functions – functionswithout argument and without returnvalue, functions with argument andwithout return value, functionswithout argument and with returnvalue, functions with argument andwith return value

51.Difference between pre-definedfunctions and user-defined functions.

52.What do you mean by pre processor directives?

53.What is a structure?

54.What is self referential structure?

55.Difference between structure andunion.

56.What is type compatibility?

57.What is enumeration?

58.Difference between getch() andgetche() functions.

59.ImpoRtant storage classes – Auto,Extern, Register, Static etc

60.What is the use of randomizefunction?

61.What are pointers?

62.What is a null pointer?

63.Difference between static memoryallocation and dynamic memoryallocation.

64.What is the importance of new anddelete operators in C++?

65.C++ memory map.

66.What do you mean by garbagevalue?

67.What is the difference between = and==?

68.What is a block or compoundstatement?

69.Define class and object.

70.What is the difference between aclass and a structure?

71.What is modularity?

72.Define abstraction and data hiding.

73.What is inheritance?

74.Different types of inheritance.

76.Define base class, super class,abstract class and derived class.

77.Visibility modes- private, public andprotected.

78.Global and local objects and their scope.

79.Difference between member functions and non-member functions.

80.What is polymorphism?

81.What are constructors anddestructors?

82.Features of a constructor.

83.Differences between constructorsand other member functions of aclass.

84.What is function over riding?

85.What is a friend function?

86.Different types of constructors –default, parameterised and copyconstructor.

87.What are files?

88.Basic operations in a file.

89.File stream classes and their uses –ifstream, ofstream and fstream.

90.Different methods used for opening afile.

91.What is a stream?

92.Different file modes – ios::app, ios::in,ios::out, ios::truncate etc.

93.Difference between seekg() andseekp(), tellg() and tellp().

94.Difference between a text file and abinary file

.95.What is eof().

96.What is a friend function?

98.What is function overriding?

99.What is this pointer?

100.Difference between primitive andnon-primitive data types.

101.Difference between stack and queue.

102.Different searching techniques usedin an array

103.Different sorting methods used in anarray

104.Define data, database, databasemanagement system

105.Data redundancy

106.What is domain?

107.What is a relation?

108.Define the terms tuple, degree,cardinality, attributes etc.

109.What is a view?

110.Difference between a table and aview.

111.What is a key?

112.Define candidate key, primary key,alternate keys, composite primarykey, foreign key etc.

113.What is the difference between selectand project operations in DBMS?

114.What is the difference between unionand set intersection operations?

115.What is SQL?

116.Different data types used in SQL.

117.Difference between character andvarchar2.118.What is data dictionary or metadata?

119.Different categories of commands used in SQL-DDL, DML,TCL and DCL.

120.What is a constraint?

121.Different constraints used in SQL –unique, primary key, default, check,not null.

122.Aggregate functions used in SQL.

123.What is pseudo column?

124.Explain the commands – SELECT,INSERT, CREATE, ALTER,UPDATE, DROP, TRUNCATE,DELETE etc.

125.What is a schema?

126.Difference between DROP andDELETE commands in a table.

1. What are inline member functions?Ans. Functions defined inside a class are inline.

2. What is the difference between ordinary functions and inline functions?

Ans. No function call is made to inline functions as the source code is copied to the program during compilation whereas in ordinary functions, the control is switched over to the function block when function is called.

3. What are the situations where the inline functions do not work?

Ans. Inline functions does not work in the following situations

a. functions with return values,or having switch, goto, or loop

b. functions containing static variables

c. a recursive function

d. function having return statement (even if it does not return values)

4. What are the basic differences between a structure and a class?

Ans. Structure has only data members whereas class has both data member and member functions. By default all members of a structure are public whereas all members of a class are private by default.

5. What is a friend of a class?

Ans. Any ordinary function (non-member of a class) which has access privileges to the private members of a class are called friends of a class.

6. Which are the three types of (categories of ) a class function?

Ans. Accessor function – which can only access the data members(not edit it), mutator function – which can manipulate the data members (getdata(),calculate()), manager function – specific functions (constructor, destructor)

7. Explain Encapsulation, Data hiding, Data Abstraction with reference to classes.

8. What must be done to make the static data member of a class work?

Ans. Declaration within class and definition outside the class

9. What is the difference between static member function and ordinary member functions:

Ans. Static function of a class can access only the other static members of a class. Static function of a class is invoked by using the class name instead of object name.

10. How does the memory allocation for member functions and data members take place?

Ans. Member functions are created and placed in memory only once when the class is defined. The memory is allocated for objects’data members when the objects are declared. All objects share the same member functions.

11. Name the methods through which polymorphism is exhibited in C++?

Ans. Functions having the same name but which differs in number of type of arguments is called overloaded functions. It has nothing to do with return types( data type of functions)

13. What contributes to function overloading – function signatures or return type of function – Ans. function signature

14. Name the various types of constructors- default , parameterized, copy constructor

15. How is a copy constructor called ? Ans – It is called by call by reference only.

16. What is default constructor ?

Ans. A constructor with no arguments or all arguments having default values.

17. What are the uses of scope resolution?

Ans- used to defined methods of a class outside the class, to unhide global variable having the same name as the local variable in a block

18. What do you mean by temporary instance of a class?

Ans. Objects created for the purpose of execution only. …..

19. The differences between constructors and destructor are:

Ans. constructors can take arguments but destructor can’t , constructors can be overloaded but destructors can’t be overloaded.

20. Write a statement in C++ to prove that even primitive data types have constructors . Ans – int k(2).

21. What are the privileges of friend function of a class- to access the private and protected members of a class

22. What happens when constructor functions are invoked – objects are created.

23. How many ways of representing an integer – decimal, octal and hexadecimal

24. Which is the standard library –iostream.h

25. Difference between goto and gotoxy – goto is C++ statement and gotoxy () is a function defined in conio.h

26. Why is char treated as integer? –memory represents char in ASCII codes(numeric)

27. What is the length of escape sequences ? – 1 byte.

28. Name the only data type of which we cannot declare any variables?

Ans. Void

29. Name the fundamental data types of C++

Ans. Int, char, float, double, void.

30. What is the difference between Union and Enumeration?

Ans. Union is when two variables usually of different types sharing the same memory location ( any one occupies memory at a time). Enumeration is a way of declaring integer constants. Eg. Union share { int x, char y;};

Enum p{F, S, T};

31. Name an exit controlled and an entry controlled loop.

Ans. Exit controlled – do{…..}while(); Entry controlled – while(){….}

32. Which of the following is not a jump statement? Switch, goto, break, exit.

Ans. Switch.

33. Which of the following will work only in a loop – break, goto, continue, exit.

Ans. Continue and break.

34. Which is the default data type of C++? – Ans. Int

35. If a function does not have a data type specified which will be its datatype by default ? – Ans. Int

36. What is the default value of a static variable or global variable?

Ans – zero

37. Which are the storage class specifiers in C++?

Ans. Auto, register, extern, static.

38. A function that calls itself for its processing is known as – recursive function

39. Strings are character arrays. The last index of it contains the null-terminated character – ‘\0’.

40. What is the only function all C++ programs must contain? – main()

41. The directives for the preprocessors begin with – #

42. Differences between ‘a’ and “a”- ‘a’ is character of I byte whereas “a” is a string of 2 bytes.

43. What is the difference between int K[2] and int K(2) ? – first is in integer array of size 2 whereas second is declaring a variable K with initial value 2.

44. Differences between abort() and exit() – abort()- aborts “abnormal termination” exit()- closes all files and writes the buffered output before termination.

45. biggest number that can be represented by – int (32,767) and unsigned int (65,535)

46.

Structure:47. What is the difference between a structure and an array?

Ans. Structures are heterogeneous collection of data whereas arrays are homogenous collection of data. Members of a structure are referred to by dot operator whereas array elements are referred to by subscript values.

48. What is the condition of assigning one structure to another?

Ans. Both structures must be of the same type ( same tag name)

49. What is the difference between typedef and reference variable?

Ans. Typedef creates an alternative name for a standard data type whereas reference creates an alternative name for a variable.

50. What is the function of #define?

Ans. Used to declare symbolic constants and macros.

51. What is the default inheritance visibility mode? – private (if no visibility is specified it is private)

52. Can a derived class access the private members of the base class? If Yes, how? – can only access them through the nonprivate members.

53. What is inheritance graph? – derivation form multiple base classes.

54. what is order of constructor and destructor invocation in case of inheritance.?

When object of derived is inherited first the constructor of base class and then the derived class but for destructor first the destructor of derived class and then the base class is invoked.

55. What is the difference between protected and private members of class –

Ans. protected members are inheritable –private members are not.

56. What is the size of a class without any data member?

1 byte.

57. Which operator can be used prove that the private members of the base class are actually hidden in the derived (visible ) but not accessible?

Ans. Sizeof() operator on the object of the derived class will prove this.

58. What is Virtual Base classes?

Ans. In multiple bases classes are inherited.

59. What is containership or aggregation or containment?

Ans. When a class contains objects of other class types as its members it is called containership

60. Explain Has- A relationship, Is – A relationship.

Ans. When a class inherits from another class, the derived has a IS-A relationship with the base class. When a class contains the object of another class type – then the class containing the object has a HAS –A relationship with the contained class.

61. When a subclass is a base class of another class it is – multilevel inheritance.

62. What is function overriding ?

Ans. When a function of base class is re-defined in derived class – it is called function overriding.

63. What is the advantage of inheritance ? Ans – code reusability and saving of programming time.

64. Differentiate between ‘IS-A’ , ‘HAS-A’ and ‘HOLDS-A’ relationship in inheritance.

65. What are visibility modes ? Differentiate between them.

Ans. Private, protected, public.

66. by default all files are treated as – text files in C++ ( not binary)

67. explain the file modes – ios::ate, ios::app, ios::noncreate….

68. difference between get() and getline().

69. use of seekg, seekp , tellg, tellp.

70. What is a stream ?

Ans. A sequence of bytes – flow of bytes into or out of a program.

71. Name the stream classes in C++ for I/O – ofstream, ifstream, fstream.

72. Name the member functions belonging to fstream class – get(), seekp(), seekg()

73. What is the difference between binary and text files?

74. Which functions can be used to manage binary files in C++ ?

75. While writing class objects what is written to files data members or member functions?

Ans. Only data members.

76. How random access is is managed in C++?

Ans. Random access is managed by using seekg(), seekp(), tellg(), tellp() functions.

77. What is the difference between constant pointers and pointer to a constant?

78. What is the disadvantage of calling a function by reference?

Ans. When a function is called by reference method only variables can be passed not constants or expressions as in call by value method.

79. Which operator is used to refer to the object pointers(class and structure) ?

Ans. Arrow operators ->

80. What is this pointer? – explain

81. State two situations in which this pointer is not used in classes?

Ans. static member functions do not have this pointer and friend functions are not passed this pointer

82. Which are the two memory management operators in C++.

Ans. New and delete.

83. What is Static memory allocation and dynamic allocation ? static- at compilation time and dynamic at run time(using NEW operator)

84. What is life time of dynamically allocated memory variable ? – till it is de-allocated.

85. What is memory leak – if the no. of dynamically allotted memory variable are not deleted using delete –

86. How are arrays passed to a function? – by reference/pointers and not by value method

87. What do you mean by traversal – processing all data elements of an array is called traversal.

88. What is the size of an array A [-10…..20] ? – 31

89. What is a vector – a numeric one dimensional array.

90. Which are the two ways of memory allocation of a 2-D array – row and column major

91. What is the precondition for a binary search ? – array should be sorted.

92. Stack is – LIFO and Queue is FIFO.

93. Which are the two types of queues ? circular and dequeue

94. Differentiate between arrays, stacks and queues.

95. Merits and demerits of linear and binary search.

Ans. Linear search – demerits takes more iterations to find an element especially if it is towards the end of array. Array need not be sorted.

96. If arr is an array of integer – is arr++ expression legal – why? (no- base address of a array cannot be changed)

97.  Definition of database,relation,,DBMS,RDBMS, domain, field, tuple, attribute, cardinality, degree, primary key, alternate key.

98. Operations on relation – selection, projection, union ,Cartesian product

99.Difference between create table and alter table , create table and create view commands, delete table and drop table.

100. Group functions – sum(), max(), min(), avg(), count()

101. Differentiate between DDL and DML commands with example.

102. Universal gates – NAND and NOR . Why are they called universal gates.

103. Main theorems of Boolean Algebra, principle of duality

104. Definitions of network,Internet,switching techniques-Circuit, Message, Packet, Transmission media- Twisted, coaxial cable, optical fibre, micro wave, radio wave, satellite, buad rate, bandwidth,LAN,MAN,WAN,totplogies,hub,switch,router,bridge,repeater,firewall,cookies

2. 105. FULL forms of HTTP, FTP,TCP/IP,SLIP/PPP, MODEM,CDMA,WLL,SMS,WWW,URL

106.What is function prototype and function signature.

107.Differentiate between call by value and call by reference.

109.What is pointer to an array and an array of pointers.

110.Differentiate between Structure and Class.

111.What is inline function.

Compiled By :    Paritosh Srivastava

PGT(Comp)

KV Aliganj