Roll No. …………………..
BCA-C–404
B. C. A. (Fourth Semester)
EXAMINATION, 2023-24
PROGRAMMING IN JAVA
Time : 212 Hours
Maximum Marks : 60
Note : All questions have to be attempted.
Section—A
1. Multiple Choice Type Questions : 1 each
(i) Which statement is used to compile the
„First.java‟ file in command prompt ?
(CO1, BL-1)
(a) java First.java
(b) javac First.java
(c) cjava First.java
(d) java compile First.java
P. T. O.
[2] BCA-C–404
(ii) Which keyword is used to invoke parent class
constructor ? (CO1, BL-1)
(a) this
(b) final
(c) parent
(d) super
(iii) Which area is used by JVM to store object data ?
(CO1, BL-1)
(a) stack area
(b) heap area
(c) method area
(d) None of the above
(iv) What will be the output of the program ?
(CO2, BL-4)
String x = “xyz”;
x.toUpperCaseQ;
String y = x.replace(„Y‟, „y‟);
y = y + “abc”;
System.out.println(y);
(a) abcXyZ
(b) abcxyz
(c) xyzabc
(d) XyZabc
[3] BCA-C–404
(v) What is the extension of byte code file ?
(CO1, BL-1)
(a) .exe
(b) .java
(c) .byte
(d) .class
(vi) Late Binding is also known as : (CO1, BL-1)
(a) compile time polymorphism
(b) runtime polymorphism
(c) dynamic polymorphism
(d) Both (b) and (c)
(vii) println( ) is a method of which class ?
(CO1, BL-1)
(a) Scanner
(b) System
(c) Print
(d) Print Stream
(viii) What will be the output of the program ?
(CO2, BL-5)
public static void main (String[] args)
{
int[] arr={10,3,4,5}
for(int i=3;i<arr.length;i++)
{
If(arr[i]>arr[i+1])
{
}
}
}
P. T. O.
[4] BCA-C–404
(a) nothing will print
(b) compile time error
(c) run time error
(d) None of the above
(ix) What will be the output of the program ?
(CO2, BL-5)
class A
{
public A(int x){ }
}
class B extends A { }
public class test
{
public static void main (String args [])
{
A a = new B();
System.out.println(“complete”);
}
}
(a) Compile Time Error
(b) Run Time Error
(c) Nothing will print
(d) Complete
[5] BCA-C–404
(x) Which method is used to start the execution of the
thread ? (CO1, BL-1)
(a) run ()
(b) begin ()
(c) getstart ()
(d) start ()
(xi) Which statement is false ? (CO1, BL-1)
(a) JDBC stands for Java database Connectivity
(b) JDBC is a Java API to connect and execute
the query with the database.
(c) It is not part of JavaSE
(d) JDBC API uses JDBC drivers.
(xii) What will be the output ? (CO2, BL-5)
int i = 1, j = 10;
do
{
if(i++> --j) /* Line 4 */
{
continue;
}
} while (i < 5);
System.out.println(“i = “ + i + “and j = “ + j);
(a) i = 5 and j = 6
(b) i = 6 and j = 5
(c) i = 5 and j = 5
(d) i = 6 and j = 6
P. T. O.
[6] BCA-C–404
2. Write short notes on any four : 3 each
(a) Why we call abstract class is achieve partial
abstraction ? Give an example also. (CO1, BL-3)
(b) Why string is immutable ? Explanation with
example. (CO1, BL-1)
(c) What are the three properties of the final keyword ?
(CO1, BL- 1)
(d) Write a java program to count total number of „is‟
words in a string. (CO1, BL-2)
(e) What are the five steps to connect any java
application with the database using JDBC.
(CO4, BL-4)
Section—B
(Long Answer Type Questions)
3. Attempt any two of the following : 6 each
(a) Explain the internal structure or details of JVM
with proper diagram. (CO1, BL-1)
(b) What is abstraction ? Through which 2 ways we
can achieve abstraction ? What is abstract class ?
Write a java program to create two abstract
methods in a class named as “area () and “volume
Q”. Creating another class named as “Cuboid”
inherits the class in which two abstract methods
define and calculate the area and volume of a
cuboid. (CO5, BL-6)
[7] BCA-C–404
(c) How string builder and string buffer class differs
from string ? Explain any five inbuilt methods of
string buffer class with the help of an example.
(CO2, BL-2)
4. Attempt any two of the following : 6 each
(a) How method overloading differs from overriding ?
Explain with the help of an example. Write a java
program to check how many vowels are in odd
location in a string. (CO2, BL-3)
(b) What is multithreading and why multithreading is
required in java ? Explain the life cycle of a
thread. Write a java program to create a thread
through interface. (CO5, BL-6)
(c) How an Interface achieve fully abstraction and
multiple inheritance ? Explain with an example.
Write a java program to calculate the
multiplication of two matrix. (CO5, BL-6)
5. Attempt any two of the following : 6 each
(a) What is swing in java ? How does java swing
differ from AWT ? Draw the hierarchy of java
swing APT. Write a java program to create one
button named as “click here” and display “java is
a programming language” when user click on
button “click here”. (CO 3, BL-6)
P. T. O.
[8] BCA-C–404
(b) What is an exception ? Why is exception handling
required ? How exception can be handled ? Write
a java program to demonstrate the use of finally
block and throw keyword to handle the exception.
(CO5, BL-6)
(c) What is JDBC ? Explain types of JDBC. Write a
java program to create a table named as employee
with fields empid, empname and salary. Insert
three records inside the employee table.
(CO4, BL-6)
BCA-C–404