Sunteți pe pagina 1din 3

Sir J.C.

BOSE SCHOOL OF ENGINEERING



Suggestion 1st Internal Test, B.Tech
Discipline: CSE
5
th
sem

Group A
(Multiple Choice Type Questions)
1. Choose the correct alternatives.
i) What is the prototype of the default constructor of the class Test
a) Test ( ) b) Test (void) c) public Test ( ) d) public Test (void)

ii) What is the output of the following code
public class A
{ void A( ) /*Line3*/
{ System.out.println(Class A);
}
public static void main (String args [ ])
{ new A( );
}
}

a) Compilation fails b) An exception is thrown at line3

c) The code executes with no output (d) Class A

iii) What is the output of the following code
class Test
{ public static void main (String args [ ])
{ int x=0;
int y=0;
for (int z=0; z<5; z++)
{ if( (++x>2) | | (++y>2) )
{ x++;
}
}
System.out.println(x + " " + y);
}
}

a) 5 3 b) 8 2 c) 8 3 d) 8 5










iv) What is the result of the following code
class Age
{
public static void main (String args [ ])
{ int age;
age=age+1;
System.out.println( " The Age Is" + age);
}
}

a) Compile and execute with no output b) Compilation Error

c) The Age Is 1 d) None of these

v) A static method can refer
a) this b) super
c) Both (a) and (b) d) None (a) and (b)

vi) What is the numerical range of a char?
a) -128 to 127 c) -(2
15)
to (2
15
) - 1
b)0 to 32767 d)0 to 65535


vii) Which one is a valid declaration of a boolean?
a) boolean b1 = 0;
b) boolean b2 = 'false';
c) boolean b3 = false;
.d) boolean b4 = Boolean.false();
e). boolean b5 = no;


viii) Which one is a previous name of java
a ) iak c) eak
b) oak d) yak

ix) Which is a valid keyword in java?
a) Float c) interface
b) string d) unsigned







Group B

2. What do you mean by object oriented programming? Write the difference between C++ and Java?
3. Create a complex number class. The class should have a constructor and methods to add, subtract
and multiply to complex numbers and return the real and imaginary parts.
4. Write a program to depict constructor chaining using this keyword.
5. Write a java code to explain constructor and method overloading.
6. Write a java code to explain method overriding.
7. Write a java code to explain Anonymous class.

Group C

4. What is the advantage of static members? Discuss limitations of static methods.
Demonstrate static method and static variable with a JAVA program.
5. Explain all the access modifiers with examples. Write a program in java to implement that an
interface can inherit another interface.
6. Define a Class name as College as shown below.
Data Member:
a) collegename
b) address
Method:
a) showColllegeDetails () to show the details about the college.
Define another class named Department that inherits College and has the following:
Data Member:
a) departmentName
b) HODname
Method:
a) showDepartmentDetails() to show the details about the department.
Define another class named FacultyMember that inherits Department and has the following:
Data Member:
a)FacultyMemberName
b) Qualification
c) noOfYearsWorked
Method:
a) showFacultyMemberDetails() to show the details of faculty members within a particular
Department in a College

7. Write short notes on the topics below.
a) Polymorphism
b) Encapsulation
c) Abstract keyword
d) Final

S-ar putea să vă placă și