Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  India NewsIndia News  
Keywords
UNION SELECT RESULT YEAR science CLASS paper ICSE CASE papers question physics 2004 2009 2007 2010 prelim graph computer 2006
Latest topics
» Nitration of aniline - IIT JEE 2018 Advanced - solved
sample - Computer sample questions EmptyFri Jun 08, 2018 2:34 am by adianadiadi

» Diamagnetic - Paramagnetic - Ni(CO)4, [Ni(CN)4]2- and [NiCl4
sample - Computer sample questions EmptyFri Apr 06, 2018 1:05 am by adianadiadi

» IIT JEE chemistry solved interactive question paper
sample - Computer sample questions EmptySun Oct 29, 2017 12:11 pm by adianadiadi

» IIT JEE 2015 SOLVED QUESTION PAPER
sample - Computer sample questions EmptyWed Oct 19, 2016 1:44 pm by adianadiadi

» IIT JEE chemistry solved questions
sample - Computer sample questions EmptySat Jul 18, 2015 6:15 pm by adianadiadi

» General Description of Chinese Market for Foaming Agent ADC
sample - Computer sample questions EmptyFri May 09, 2014 2:09 pm by happybaicaitou

» How to get Lowest Cost MBBS Admission?
sample - Computer sample questions EmptyMon Feb 24, 2014 6:39 pm by MENTOR 2014

»  girl boy vashikaran specialist agori baba ji +91-9461165
sample - Computer sample questions EmptyTue Jan 21, 2014 6:00 pm by krshastri

»  STRONG LOST LOVE SPELL +91-9461165176
sample - Computer sample questions EmptyTue Jan 21, 2014 6:00 pm by krshastri

Top posters
abhas
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
Anu..i luv icse...:)
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
G-7
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
siya
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
Candy
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
jOhNy
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
Apurva
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
WinRrule
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
ambili
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 
saif
sample - Computer sample questions Vote_lcapsample - Computer sample questions Voting_barsample - Computer sample questions Vote_rcap 



Search if you can't find it here

Computer sample questions

View previous topic View next topic Go down
AuthorMessage
admin
Admin
Admin
admin


sample - Computer sample questions Vide
PostSubject: Computer sample questions sample - Computer sample questions EmptyFri Nov 23, 2007 11:39 am

source :
http://www.chandanarora.blogspot.com
Posted by chandan
--------------------------------------------------------------------------------

Q1.
a)Name two types of java programs?
Ans:Java is of dual utility. Applications and Applets.
Applications: Standalone Java programs executed independently of a browser. The execution is done using the Java interpreter.

Applets: Programs that are called through an HTML page and run on a Java-enabled browser. User’s PC downloads these Java bytecode from the Internet and run them on their own machines. To run an applet you need a java-enabled Web browser. Netscape Navigator is one of the java-enabled Web browsers.

b)Define instance variable. Give an example of the same.
Ans :The object has state and behavior, which is expressed by the variables and the methods. And the software objects are the real world objects which models a real world. It would have variables to indicate the current state and its behavior, these variables are normally called as instance variables. For example :
A ball has specific characteristics such as diameter, color, elasticity etc. We say these characteristics are necessary to the ball’s state of being. We also define a ball by what it does, such, it can be thrown or rolled or bounced. These activities are considered as the ball’s behavior. And the variables defining them will be the instance variables.

c)Differentiate between Binary search and the Linear search?
Ans : Binary search :1. Binary search searches for the given item in a sorted array
2. In this search reduces to half after every successive stage.
Linear search :1. In linear search, each element is compared with the given
item to be searched for, one by one.
2. In this method array should not be sorted one.

d) Assign the value of pie (i.e. 3.142) to a variable with requisite data type.
Ans : double pie=3.142;

e)Explain with an example the if-else-if construct
Ans : While writing a java program in case you have to define your output based on many options, then, if-else-if statements are used.
For eg.
Statement
If con1
True?
Y
Statement 1
If con2
True?
Y
Statement 2
if
else if
Statement 3
else
Statement 4

Part of the program for eg.
if(marks<40)
System.out.println(“Failed”);
else if(marks<80)
System.out.println(“Passed”);
else if(marks<100)
System.out.println(“distinction”);
else
System.out.println(“Wrong marks entered”);

Question 2
a)Differentiate between formal parameter and actual parameter.
Ans : Formal parameters :
1. The name of field to which we supply value is called formal parameter.
2. For eg.
public void mn(int x)
{
y=x+1;
}
now here the int x is a formal parameter in which value will be given to x.

Actual parameters
1. The value which is supplied to a field while entering data is called actual parameter.
2. For eg.
public void mn(int x)
{
y=x+1;
}
now here the in int x when user enters value 10 for x the value 10 becomes actual parameter.

b)Why do we need a constructor as a class member?
Ans : You cannot initialize object directly because the data parts have private access, so data members cannot be accessed directly,So,the constructors as a class members are needed to have objects initialized automatically when they are created, and to get invoked automatically by the compiler.

c)Explain the term type casting?
Ans :Type casting is converting one numerical data type to another numerical data type when it is appropriate.
For eg.
float f=3.1;
int x=(int) f; now the value of f is casted.

d) Name the following :
(i) A package that is invoked by default : class
(ii) A keyword to use the classes defined in package : import

e)Name the classes that is used for different mathematical functions. Give an example of a mathematical function.
Ans: Math class java.lang.*; is used to define mathematical functions.
Syntax : Math.function name();
For example.
Math.sin(a) : returns the sin of angle a in radians.
Math.rint( ); returns the truncated value.
Math.cbrt() : returns the cube root of the value.

Question 3
a) State the difference between = and ==.
Ans : = sign stands for assigning the value to variable while == sign in jave is a relational operator which checks for equality test between to variables.
For ex.
J=0;
Here = is an assignment operator and, j is the variable which is assigned value 0;

if(J==0)
here the relational operator == checks whether the value of j is equal to 0 or not. It gives Boolean result.

b)Write an equivalent Java syntax for the following expression
Ans : double a = (0.05-(2*y*y*y))/(x-y)

c)Rewrite the following using Ternary operator.
Ans : If(income<=10000)?0:12;

d)Write a statement for each of the following :
1. Store number 275 as string.
Ans : Strng numb=”275”;

2. Convert the string into numeric value.
Ans : c=Integer.parseInt(numb);

3.Add it to the existing total of 1000 to update the total.
Ans : total=total+c;

e)
1.What is the role of keyword “void” in declaring functions
Ans: Void is keyword used to define the return type of the function. Void return type means the method does not return any value to its caller function.
For eg.
public void add()
{
x=j+1;
}
here the function add is void that means it is not returning any value to the caller function.

2.If a function contains several return statements, how many of them will be executed?
Ans : If the function contains many return statements only the first return statement in the function will be executed because the return word is always the final statement in the function, so no further statements in the function will be executed once first return is ecscuted.

3. Which OOP principal implements function overloading ?
Ans : Function overloading is a best example of polymorphism.
Because the process of having two or more methods or functions within a class, with same name but different parameter list is called function overloading, and polymorphism does the same.

f)What is output of the following :
i. 42

4 ii.
Hi equals Hi -> true
Hi equals there -> false
Hi equals HI -> false
This will give error : cannot resolve symbol ,
because EqualsIgnoreCase() is not right it should be equalsIgnoreCase()

g) Evaluate the following expressions , if the values are a=2, b=3 and c=9;
Ans : 1) -22
2) 2

SECTION B
Q4 Write a method to create object of a class and call the above member method.
class salary
{
double anntax=0;
String name;
String Address;
int phone;
String sub_speci;
double sal;
double i_tax=0;
public salary()
{
name=" ";
Address=" ";
phone=0;
sub_speci=" ";
sal=0;
anntax=0;
}
public salary(String nm,String Add,int ph,String sub,double sala)
{
name=nm;
Address=Add;
phone=ph;
sub_speci=sub;
sal=sala;
}
public void dispdet()
{
System.out.println("name "+name);
System.out.println("Address "+Address);
System.out.println("phone "+phone);
System.out.println("subject specialisation "+sub_speci);
System.out.println("salary "+sal);
System.out.println("tax "+anntax);
}
public double taxcompute()
{
double t=sal*12;
if(t>175000)
anntax=sal*0.05;
else
anntax=0;
return anntax;
}}
class dvd
{
public static void main()
{
salary teacher=new salary();
teacher.taxcompute();
teacher.dispdet();
}
}

Question 5
Write a program to compute and display the sum of the following series.
class ser1
{
public void main(int num)
{
double sum1=0,sum2=1,sum3=0;
int i,j;
for(i=1;i<=num;i++)
{
for(j=1;j<=i;j++)
{
sum1=sum1+j;
sum2=sum2*j;
}
sum3=sum3+(sum1/sum2);
}
// System.out.println(sum1);
// System.out.println(sum2);
System.out.println(sum3);
}}

Question 6
Write a program to initialize given data in an array and find the minimum and maximum values along with the sum of the given elements.
class prog6
{
public void compute()
{
int a[]={2,5,4,1,3};
int i,suma=0;
int j;
for(i=0;i
Back to top Go down

Computer sample questions

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: Computer :: Computer help forum-