How To Exam?

a knowledge trading engine...

Amity University 2008 B.E Computer Science JAVA (Data types,variables and Arrays) - Question Paper

Tuesday, 15 January 2013 08:30Web

Data types,variables and Arrays
1) What is meant by variable?
Ans: Variables are locations in memory that can hold values. Before assigning any value to a variable, it must be declared.
2) elaborate the types of variables in Java? elaborate their uses?
Ans: Java has 3 types of variables namely, the instance variable, the local variable and the class variable.
Local variables are used inside blocks as counters or in methods as temporary variables and are used to store info needed by a single method.
Instance variables are used to describe attributes or the state of a particular object and are used to store info needed by multiple methods in the objects.
Class variables are global to a class and to all the instances of the class and are useful for communicating ranging from various objects of all the identical class or keeping track of global states.
3) How are the variables declared?
Ans: Variables can be declared anywhere in the method definition and can be initialized during their declaration.They are commonly declared before usage at the beginning of the definition.
Variables with the identical data kind can be declared together. Local variables must be provided a value before usage.
4) elaborate variable types?
Ans: Variable kinds can be any data kind that java supports, which includes the 8 primitive data types, the name of a class or interface and an array.
5) How do you assign values to variables?
Ans: Values are assigned to variables using the assignment operator =.
6) What is a literal? How many kinds of literals are there?
Ans: A literal represents a value of a certain kind where the kind defines how that value behaves.
There are various kinds of literals namely number literals, character literals,
boolean literals, string literals,etc.
7) What is an array?
Ans: An array is an object that stores a list of items.
8) How do you declare an array?
Ans: Array variable shows the kind of object that the array holds.
Ex: int arr[];
9) Java supports multidimensional arrays.
Ans: a.
10) An array of arrays can be created.
Ans: a.
11) What is a string?
Ans: A combination of characters is called as string.
12) Strings are instances of the class String.
Ans: a.
13) When a string literal is used in the program, Java automatically creates instances of the string class.
Ans: a.
14) Which operator is to create and concatenate string?
Ans: Addition operator(+).
15) Which of the subsequent declare an array of string objects?
a. String[ ] s;
b. String [ ]s:
c. String[ s]:
d. String s[ ]:
Ans : a, b and d

( 0 Votes )

Add comment

Security code

Earning:   Approval pending.
You are here: PAPER Amity University 2008 B.E Computer Science JAVA (Data types,variables and Arrays) - Question Paper