This is a Tutorial site for school and college students. Programs and technical analysis on BlueJ for ICSE and ISC Students, C programming, C++ programming and Data structure through C programming language are posted here. Engineering college students can get help on C and C++ languages from this site.
Search This Blog
Monday, October 24, 2011
Expected theoretical Questions for ICSE computer examination in 2012
In this post I have given few expected question and answers for students appearing in ICSE examination 2012. Very soon I will post expected programs and more question answers.
Question: Mention different primitive data types used in Java?
Answer: Different primitive data types of java are double, long, float, int, char, boolean, short, byte.
Question: What is a class?
Answer: Class is user defined new data type. Class can be considered as template or blue print which determines the nature and behaviour of it’s instance.
Question: When do we declare a class as abstract?
Answer: Sometimes it is needed to define an incomplete class which plays an important role in inheritance. In such situation we define incomplete or abstract class.
Question: Can an abstract class be instantiated?
Answer: Abstract class can not be instantiated.
Question: What is polymorphism? Give an example?
How methods of same name are treated by the compiler?
Answer: Polymorphism is one of the three main features of object oriented programing. When same operator or same function behaves differently in different environment, it is called polymorphism.
Function overloading is an example of polymorphism where different functions with same name are used. In function overloading the argument list of the functions must be different and the return type may be same or different.
When compiler finds methods of same name, it checks the argument list and return type. The function where the perfect match is found, compiler executes that function.
Question: What modification should be made to the following code so that the
value of Pie is not changeable ? float Pie = 3.14f ;
Answer: Values of final variables in Java can not be changed. To make a variable ‘final’, the keyword final is used and the convension is that the variable name will be in all upper case characters.
final float PIE=3.14f;
Question: What are objects? How they are created in a class?
Answer: Objects are real entities created after defining a class. The nature and behaviour of objects are defined in a class.
Objects are created by executing the constructor of a class.
Question: What are exception? List some of the most common types of exception
that might occur in Java?
Answer: Exception means run time error. If any abnormal situation arises during execution of a program, java creates an object of any sub classes of Exception class and throws it in the program.
Dividing any number by zero generates ArithmeticException object. Input related abnormal situation causes IOException object.
Question: Differentiate between syntax error and logical error?
Answer: Syntax error means braces, not putting semicolon at the end of statement, spelling mistake in keywords etc. In a word gramatical mistakes are called syntax error and these type of errors are flagged by compiler while compiling the program.
Logical errors are noit detected by computer and these type of errors lead to wrong output.
Question: What is the similarity and differences between else-if ladder and switch-case
Answer: The only similarity between else-if ladder and switch is that both of them can work on multiple options. There are many differences between these two decision making statements.
Else-if can work on any type of values including objects while switch can work only on ‘int‘and ‘char’ value.
In else-if ladder, else is optional while in switch statement default is optional.
Logical operators can be used in else-if but in can not be used in switch statement.
In switch statement, at the end of each case body, a break statement is required to send the control out of switch body but no such statement is needed.
Question: Differentiate between linear searching and binary searching?
Which one is efficient?
Answer: Linear search can be done in unsorted array but the elements in an array must be in sorted order while doing binary search.
In linear search technique, each and every values are checked starting from first location to last location where as in binary search, the value to search is compared with the middle value of the array first and if needed the array is divided into two sublists and the comparing process is continued.
Although we need not check all the values while doing binary search, still linear search is better as it does not need the list to be in sorted order. Moreover, linear search can perform both unique value search as well as category wise search while binary search is applicable in unique value searching.
Question: Given String a = ”A” , b = ”a” , c = “malayalam”; What is the output?