• No results found

Computer Science Viva-Voce Question

N/A
N/A
Protected

Academic year: 2021

Share "Computer Science Viva-Voce Question"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

Computer Science

Practical Viva-Voce questions

Q. 1. Differentiate between a run-time error and syntax error. Give one example of each.

[Hint : Losic & Syntax]

Q. 2. Differentaite between a data type struct and a data type class in C++. What is the need for a

constructor function in an object. [Hint : Structures & Classes]

Q. 3. Is it possible to apply Binary Search for any sorted data? Justify.

[Hint : Yes]

Q. 4. Differentiate between a LIFO list and FIFO list.

[Hint : Stacks & Queues]

Q. 5. Write any two differences between Procedural Programming and Object Oriented

Programming. [Hint : Basic & C++]

Q. 6. What is a pointer?

[Hint : Address variable]

Q. 7. What is a Queue?

[Hint : LIFO]

Q. 8. What is the purpose of comments and indentation in a program?

[Hint : Remark]

Q. 9. List four built-in data types available in C++.

[Hint : Data Types]

Q. 10. Why arrays are called static data structure?

(2)

Q. 11. Distinguish between serial file and a sequential file.

[Hint : File Hadling]

Q. 12. What do you mean by Inheritence?

[Hint : Classes & Derived Classes]

Q. 13. What are constructors & destructors. What purpose do they serve.

[Hint : Class Functions]

Q. 14. Distinguish between an object and a class.

[Hint : Variables & Data Types]

Q. 15. What is the pre-condition for Binary Search to be performed on a single dimensional

array? [Hint : sorting]

Q. 16. Differentiate between a Character constant and a string literal or constant.

[Hint : String]

Q . 17. Differentiate between the privately & publicly derived visibility modes.

[Hint : Local & Global]

Q. 18. What is meant by linear data structure?

[Hint : Serial Data]

Q. 19. What is a Deque?

[Hint : Data Structures]

Q. 20. Differentiate between privately and publicly derived visibility modes.

[Hint : Data Hiding]

Q.21. What is a copy constructor.

[Hint : Member Function]

Q.22. Define the term sorting and searching.

(3)

Q. 23. Differentiate between static data structure & dynamic structure.

[Hint : Data Types]

Q. 24. Define the following terms: Inheritance & Encapsulation.

[Hint : OOP]

Q. 25. What is a copy constructor. What do you understand by constructor overloading.

[Hint : Function]

Q. 26. Write two major differences between Object Oriented Programming and Procedural

Programming.

[Hint : BASIC&C++]

Q. 27. What do you understand by constructor and destructor functions used in classes. How are

these functions different from other member functions. [Hint : Classes & Objects]

Q. 28. Differentiate between ifstream class and ofstream class.

[Hint : Reading/Writing]

Q. 29. Why main function is special. Give two reasons.

[Hint : Program instractions]

Q. 30. What do you understand by visibility modes in class derivations. What are these modes.

[Hint : Public, Private & Protected]

Q. 31. Differentiate between read( ) & write( ) functions.

[Hint : Read & Write records]

Q. 32. Write two advantages of using include compiler directive.

[Hint : Header Files]

Q. 33. What do you understand by default constructor and copy constructor functions used in

classes? How are these functions different from normal constructors? [Hint : Member functions]

(4)

Q. 34. Differentiate between getline( ) & getc( ) functions.

[Hint : String input]

Q. 35. Illustrate the concept of Function Overloading with the help of an example.

[Hint : Multiple Methods]

Q.36. Illustrate the use of the this pointer with the help of an example.

[Hint : Classes & Objects]

Q. 37. Encapsulation is one of the major properties of OOP. How is it implemented in C++.

[Hint : OOP features]

Q. 38. Illustrate the use of “Self Referential Structures” with the help of an example.

[Hint : Data types]

Q. 39. Reusability of classes is one of the major properties of OOP. How is it implemented in

C++.

[Hint : Objecters & Classes]

Q .40. Distinguish between: int*ptr=new int(5); & int * ptr= new int[5];

[Hint : Points & Array]

Q .41. Distinguish between ios::out & ios::app.

[Hint : File output/Append]

Q. 42. What is the purpose of Header file in a program.

[Hint : Include functions]

Q. 43. What do you understand by a Base Class and a Derived Class. If a base class and a

derived class each include a member function with the same name and arguments, which member function will be called by the object of the derived class if the scope operator is not used.

[Hint : Polymorphism]

(5)

[Hint : OOPS]

Q. 45. What is the difference between put( ) and write( ).

[Hint : Read & Write records]

Q. 46. Will a C compiler always compile C++ code?

[Hint : NO]

Q. 47. Which is not a valid keyword: public, protected, guarded

[Hint : „g‟]

Q. 48. What is the correct syntax for inheritance

a. class aclass : public superclass b. class aclass inherit superclass c. class aclass <-superclass [Hint : (a)]

Q. 49. What does the following do: for(;;) ;

[Hint : loop]

Q. 50. Of the numbers 12 23 9 28 which would be at the top of a properly implemented

maxheap? [Hint : Arrays]

Q. 51. What does the break; do in the following?

void afunction() { if(1) { break; a_function(); cout<<“Err”; } } [Hint : Breaks loop]

Q. 52. What are pointers, when declared, intialized to?

(6)

Q. 53. What is the last index number in an array of 100 characters?

[Hint : Array option Bare]

Q. 54. Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element

array? (Or go to lunch...) [Hint : Dry Run]

Q. 55. What does the following algorithm do?

set sum to zero. set i to 1. input n.

while i is less than or equal to n do {

add i to sum. increment i. }

output sum.

What would be output if the value entered for n was 0? What would be the effect of reversing the order of the statements in the loop body on the general result produced by the algorithm?

[Hint : Dry Run]

Q. 56. If an array has a 100 elements what is the allowable range of subscripts?

[Hint : Array option base]

Q. 57. What is the difference between the expressions a4 and a[4]?

[Hint : Variable & Arrary]

Q. 58. Write a declaration for a 100 element array of floats. Include an initialisation of the first

four elements to 1.0, 2.0, 3.0 and 4.0. [Hint : Array initialialion of arrays]

Q. 59. An array day is declared as follows:

int day[] = {mon, tue, wed, thu, fri};

How many elements has the array day? If the declaration is changed to int day[7] = {mon, tue, wed, thu, fri};

(7)

[Hint : Array definition]

Q. 60. What would be output by the following section of C++?

int A[5] = {1 , 2, 3, 4}; int i;

for (i=0; i<5;> [Hint : Dry Run]

Q. 61. What is wrong with the following section of program?

int A[10], i;

for (i=1; i<=10; i++) cin >> A[i]; [Hint : Dry run]

Q. 62. Write a function heading for a function which will double the first n elements of an array.

If the function was amended so that it would return false if n was larger than the size of the array how should the function heading be written? If the function was to be changed so that a new array was produced each of whose elements were double those of the input array how would the heading be written?

[Hint : Function definition]

Q. 63. What does the following do: void afunction(int *x)

{ x=new int; *x=12; } int main() { int v=10; afunction(&v); cout<

[Hint : Dry Run]

Q. 64. What do nonglobal variables default to:

a. auto b. register c. static

(8)

Q. 65. Which header file allows file i/o with streams?

a. iostream.h b. fstream.h c. fileio.h [Hint : File stream]

Q. 66. What is the outcome of cout<

a. 16 b. 17 c. 16.5 [Hint : Dry run]

Q. 67. What will strcmp(“Astring”, “Astring”); return?

[Hint : String compare]

Q. 68. Evaluate !(1&&1||1&&0)

[Hint : Logical Condition]

Q. 69. What header file is needed for exit();

[Hint : Process]

Q. 60. What ANSI C++ function clears the screen?

References

Related documents

 is the run-time determination of which function to call for a particular object of a descendant class based on the type of the argument.  declaring a member function to be virtual

Table 4.8 Pearson Correlation Statistics for the Variables 97 Table 4.9 Regression Result of transformational leadership and Crisis Management 99 Table 4.10 Regression Result

For example, if both base classes provide a member variable with the same name or a member function with the same declaration, the derived class must specify from which base class

❖ A member function invoked on an object should be the most-derived function accessible to the object’s visible type. ▪ Can determine what to invoke from the

• Write operator* for Complex numbers as an ordinary non-member function instead of as a member function of the Complex class.. Show the additions to Complex.h

class, only the public and protected members of base class can be accessed by the member functions of derived class. This means no private member of the base class

With all four financing mechanisms, price control results in a price decrease in both the monopolistic and the competitive region due to the incumbent ’s strong market power.. There