Some important distinguished topics for CBSE Class 12 Computer Science Viva Voce Questions
vivaFull description
GE 6261 Computer Aided Drafting and Modelling Lab Viva questionsFull description
Basic Viva Questions in NED University
Machine Tools Viva QuestionsFull description
Full description
Network Programming Lab Viva Questions
Full description
5th semester VTU system software viva questions
Heat Transfer Viva QuestionsFull description
Full description
Full description
Important viva questions for OOAD lab
very useful for viva in machine shop labFull description
Full description
ISC Computer Science Viva Questions and Answers What is OOP? A: Object-oriented programming (OOP) is a programming paradigm that represents concepts as “objects” “objects” that have data felds (attributes that describe the object) and associated procedures knon as methods! Is Java an Object Oriented lanuae? A: "es! What is !ncapsulation? "ow is it implemented in Java? A: #inding up o$ data and associated $unctions together into a single unit called (class) is called %ncapsulation! %ncapsulation! &n 'ava it is implemented b the use o$ a class! What is #ata Abstraction? "ow is it implemented implemented in Java? A: Act o$ representing onl essential $eatures ithout including its background details is called Abstraction! *ata Abstraction can also be defned as the process o$ hiding the implementation details and shoing onl the $unctionalit! &n 'ava it is implemented b the use o$ inter$aces or b making the class abstract! What is Pol$morphism? "ow is it implemented in Java? A: &t literall means the abilit to take +more than one $orms,! he abilit o$ a method to behave in more than one $orm is called polmorphism! &n 'ava it is implemented b method ($unction) overloading (compile time polmorphism) and method overriding (runtime polmorphism)! polmorphism)! What is Inheritance? "ow is it implemented implemented in Java? A: he abilit o$ a class to adopt.share the properties (data and $unctions) completel or partiall $rom another class is called &nheritance! &n 'ava it is implemented b the use o$ the keord e/tends! What is the bene%t o& Inheritance? A: &t is a ver use$ul $eature as it provides the concept o$ reusabilit! Also it allos us to include or remove an $eatures to an e/isting class ithout modi$ing it! What is sini%cance o& import java'io'( in $our proram? A: he line imports all the classes o$ the java!io package into the current program! )ive some e*amples o& pac+aes' A: java!util java!lang etc! Wh$ did $ou write java'util pac+ae? ,onl$ i& $ou use classes li+e Scanner or Strin-o+eni.er/ Strin-o+eni.er/ A: o include the $unctions o$ the 0canner or 0tringokeni1er class $rom the java!util package! What is a class? A: A class is a blueprint or prototpe $rom hich objects are created!
What is an object? A: An object is an instance o$ a class! "ow to create an object? A: Objects o$ a class can be created as b declaring it and then instantiating it using the +ne, operator as $ollos: class-name object-name 2 ne class-name()3 %/ample: Point ob 2 ne Point()3 he above line creates an object o$ the Point class! Wh$ do $ou write 0u1ered2eader br 3 new 44' ? A: o activate the #u4er memor $or e5cient input and output operations! +br, is an object o$ the #u4ered6eader class! What is a 0u1er and what is its use? A: #u4er is a temporar memor used $or e5cient input and output operations! What is the &unction o& read5ine,/ method? A: read7ine() method reads a line o$ te/t (hich ou input) and returns the result in the $orm o$ a 0tring! Wh$ do we have main,/ &unction? A: he e/ecution o$ the program begins $rom the main() method! Wh$ is the main method public? A: 0o that it be accessible to the '89 hich begins to e/ecute the program $rom outside o$ the class! Wh$ is the main method static? A: 0o that it be available $or e/ecution ithout the need o$ an object! Is it compulsor$ to write Strin ars67 when runnin a proram in 0lueJ? A: o it is not compulsor hen e are running it in #lue'! #ut normall (in all other cases) it is alas better to have it as the '89 looks $or the main method ith a 0tring arra as a parameter! What is the use o& out in S$stem'out'println,/? A: +out, is an object o$ the +Print0tream class and a static data member o$ the,0stem, class hich is calling the println() $unction! What is the di1erence between print,/ and println,/ methods? A: he print() $unctions prints a line and the control remains on the same line hereas the println() $unction prints a line and the control moves on to the ne/t line! Can a pac+ae be called as a class? A: "es Package is actuall a class present in java!lang package! Wh$ do $ou write 8throws IO!9ception:?
A: ;or handling an input.output e/ceptions!
What are e*ceptions? A: %/ceptions are runtime errors hich prevent the program $rom orking normall! ;ention the two t$pes o& e*ceptions? A: nchecked %/ceptions = %/ceptions hich are not checked during compile time! %/ample: Arra&nde/OutO$#ound!
;ention other wa$s in which java handles e*ceptions' A: 'ava can handle e/ception using the tr-catch block thros keord and thro keord! What is the di1erence between throws and throw? A: >sing thros keord e can give sstem defned error message i$ an error occurs hile using thro keord e can $orce an e/ception and give user-defned error messages! What is tr$
Wh$ is the 8S: o& S$stem'out'println,/ &unction capital?
A: 0stem is the name o$ a class present in javalang package and hence it begins ith a capital letter as is the convention $or class names!
Wh$ is the 8S: o& Strin capital? A: 0ince 0tring is a class!
What is a variable? A: A variable is a named memor location hose value can change!
What is a constant? A: A constant is a literal hich cannot be changed!
"ow do $ou ma+e a variable into a constant? A: # adding the keord +fnal, be$ore a variable declarations! %/ample: fnal int a 2 B3
What are post%* and pre%* operators? A: #oth postf/ and pref/ operators change (increase or decrease) the value o$ a variable b C! &n postf/ the old value o$ the variable is frst used and then the variable is updated to the ne value hereas in pref/ the value o$ the variable is frst updated to the ne value and then this ne value is used!
What is the use o& %nal +e$word? A: ;inal can be used in three scenarios: a) fnal be$ore a variable makes it a constant! b) fnal be$ore a $unction declaration prevents it $rom being overridden! c) fnal be$ore a class declaration prevents it $rom being inherited!
What is a class variable? A: &nstance variables having the keord +static, be$ore it is a class variable! ;or ever object there is just one cop o$ the variable made!
What does S$stem'in'read,/ return? A: &t returns the number o$ btes read $rom the &nput 0tream as an integer!
Wh$ do $ou write 8Inteer'parseInt,br'read5ine,//:? A: he inputs in a java program comes in the $orm o$ 0tring objects hich are read using the br!read7ine() $unction! o i$ e ant the input in integer $orm e have to convert it into integer using the parse&nt() $unction o$ the &nteger rapper class!
What are wrapper class?
A rapper class is a class hich raps (encloses) around a data tpe and gives it an object appearance! Dherever the data tpe is reEuired as an object this object can be used!
What is t$pe conversion? =ame its t$pes' A:
What is the di1erence between castin and coercion? A: pe
What is the di1erence between i& and switch? A: (a) i$ can compare conditions $or all data tpes hereas sitch can onl check integers and characters! (b) all kinds o$ relations can be checked using i$ hereas onl eEualit relation can be checked using sitch!
What is &all
What is the di1erence between &or and while? A: he di4erence lies in the a the are commonl used! $or loop is commonl used hen the number o$ iterations are knon hereas hile loop is commonl used hen the number o$ iterations are not knon!
What is the di1erence between do
What is recursion?
A: &t is a process in hich a $unction calls itsel$ repeatedl until some base condition is satisfed!
What is the di1erence between recursion and iteration? A: 6ecursion is usuall sloer than iteration due to overhead o$ maintaining stack hereas &teration does not use stack so it,s $aster than recursion! 6ecursion uses more memor than iteration hereas &teration consume less memor! 6ecursion makes code smaller hereas &teration makes code longer!
What is the use o& return +e$word? A: return keord is used to return an value $rom a $unction! &t denotes the end o$ a $unction!
Can there be multiple return statements in a &unction? A: "es but onl one o$ them is e/ecuted!
Can two &unctions have the same name? )ive e*amples' A: "es! &n $unction overloading and $unction overriding!
What is the di1erence between &unction overloadin and &unction overridin? A: &n $unction overloading onl the $unction name is same but $unction signature (list o$ parameters) is di4erent hereas in $unction overriding both the $unction name as ell as $unction signature are same ;unction overloading takes place ithin the same class hereas $unction overriding takes place in a child and a parent class! ;unction overloading is an e/ample o$ static polmorphism hereas $unction overriding is an e/ample o$ dnamic polmorphism!
What is a constructor? A: &t is a member $unction ith the same name as that o$ a class and is automaticall called $or initiali1ing the variables o$ an object!
What is a cop$ constructor? A: &t is a constructor hich takes object as parameter and copies the value o$ the instance variable o$ that object to another object (creates a cop o$ an object)!
What is the de&ault access speci%er?
A: $riendl
What is a modi%er? A: A modifer is a keord placed in a class method or variable declaration that changes ho it operates! %/amples o$ modifers are: abstract fnal static etc!
What is the de&ault java pac+ae? A: java!lang
What is the use o& 8new: +e$word? A: &t is used $or dnamic memor allocation to re$erence data tpes!
What is the use o& 8this: +e$word? A: &t is used to re$er to the current object (the object hich calls the $unction)!
What are arra$s? A: Arras are a collection o$ variables o$ the same data-tpe re$erenced b a common name!
What is the sini%cance o& arra$s? A: &t helps to group similar variables under a common name hence reducing the number o$ names o$ variables e have to remember!
What is Strin-o+eni.er or Scanner and e*amples o& similar classes ,i& $ou used it/ A: 0tringokeni1er or 0canner is a class hich splits up an given string into tokens separated b delimiters!
=ame some other concepts related to Scanner>Strin-o+eni.er A: 0canner class 0tringokeni1er class split() $unction!
What is split,/ &unction?
A: split() $unction is a $unction o$ the 0tring class and it breaks up an 0tring into tokens and outputs the result in the $orm o$ an arra!
What is the use o& charAt,/ &unction? A: his $unction is used to e/tract characters at an given inde/ $rom a 0tring!
What is the di1erence between lenth,/ and lenth? A: length() $unction is used to fnd the number o$ characters present in a 0tring hereas length keord is used to fnd the number i$ cells in an arra!
What is the di1erence between brea+ and continue? A: break keord stops the complete loop and takes the control out o$ the loop hereas the continue keord just stops the current iteration and takes the control to the ne/t iteration!
What is the di1erence between selection sort and bubble sort? A: &n selection sort successive rounds are e/ecuted to select the element hich is reEuired to be placed in their sorted position hereas in bubble sort ever consecutive pairs o$ elements are compared and interchanged as reEuired to place them in their sorted position! &$ e are arranging an arra is ascending order then in selection sort e get the smallest element at ever pass hereas in bubble sort e get the largest element in ever pass!
What is the drawbac+ o& an arra$? A: &ts si1e cannot be changed!
When does 0inar$ search &ail? A: Dhen the arra is not sorted!
What is the di1erence between linear and binar$ search? A: 7inear search does not reEuire the arra to be sorted hereas binar search reEuires that the arra be sorted! 7inear search checks $or the search item in a linear $ashion $rom the beginning cell till the end hereas #inar search repeatedl dividing the arra into halves and the search takes place in one o$ the halves! he element is searched in the middle cell o$ ever hal$! he %/aminer ma ask ou to e/plain in brie$ the logic used ou to solve the program!
"ou kno hat ou have ritten so just give a brie$ summar o$ the logic used b ou! he %/aminer ma ask ou to tell hat is control variable in our loop! 0o i$ our loop is $or(int i 2 C3 i F2 B3 iGG) then the control variable is +i,! he %/aminer ma ask ou to tell hat is the return tpe o$ a $unction ou used! 0o i$ our $unction is boolean isPrime(int n) then the return tpe is +boolean,!
What is a ueue? )ive a real li&e e*ample' A: &t is a linear data structure hich $ollos the ;&;O (;irst &n ;irst out) pattern! 6eal li$e e/ample: Hueue at the ticket counter
What is a stac+? State it:s application' A: &t is a linear data structure hich $ollos the 7&;O (7ast &n ;irst out) pattern! 0tack memor is used in recursion! Application: &t can be used $or reversing strings $or evaluating postf/ e/pressions!
What is an abstract class? A: An abstract class is a class that is declared abstractIit ma or ma not include abstract methods! Abstract classes cannot be instantiated but the can be subclassed!
What is an abstract method? A: An abstract method is a method that is declared ithout an implementation (ithout braces and $olloed b a semicolon) like this: abstract void point(double / double )3
What is the di1erence between +e$words and reserved words? A: Jeords have a special meaning in a language and are part o$ the snta/! 6eserved ords are ords that cannot be used as identifers (variables $unctions etc!) because the are reserved b the language! %/ample: &n 'ava goto is a reserved ord but not a keord (as a conseEuence ou cannot use it at all)
What is the similarit$ between a method and a constructor? A: #elo are some o$ the similarities: C) #oth o$ them are member methods o$ an class! K) #oth can be parameterised or non-parameterised! L) #oth can be overloaded!
What is the di1erence between namin conventions and namin rules? A: 8iolating naming rules ill result in a snta/ error hereas violating naming conventions ill not result in an error!
What error will be enerated i& a space is iven between the loical A=# operator ,@@/? Will it be a compile
What is an inter&ace? "ow is it use&ul? A: &nter$ace is like a class that contains declaration o$ methods and variables ithout the $unction defnition! &t helps in implementing multiple inheritance!
What is super +e$word? A: &t is a keord hich is used to access the data members and methods o$ the super class $rom ithin the sub class!
What is super constructor? A: &t is a constructor hich is used to call the constructor o$ the super class and hence initiali1e the data members o$ the super class $rom ithin the sub class!
What is comple*it$? A:
What are the di1erent t$pes o& comple*ities? A: ime
What is the di1erence between Call b$ value and Call b$ re&erence? A: