[go: up one dir, main page]

0% found this document useful (0 votes)
11 views4 pages

TCIE-II Set1 3

Uploaded by

dsah756
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

TCIE-II Set1 3

Uploaded by

dsah756
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

RK UNIVERSITY

School of Engineering
TCIE II (October - 2024)
Semester – 3
Date: 18-10-2024 Branch: BCA
Subject Name: Programming with Java Subject code: BCA421
Time: 1 Hour & 30 Minutes Total Marks: 20
-------------------------------------------------------------------------------------------------------------------------------
---

Instructions to Candidates:
1. Read the context, problem description, requirements and other details
carefully and implement the solution.
2. This assessment is intended to test the hands on skills related Java Programming
3. Create a new Java Application Project to fulfill following requirements.

Each requirement carries below mentioned marks.

REQUIREMENTS:
Modify or Create .html and .java files to reflect the following requirements
Require- Requirement Description Max
ment ID Marks
Q_ 1 Create a code in Java which displays RollNo and Name using Scanner 2
Class.
Q_ 2 Create a class BCA3 in java which use concept of class and object. 2
Class BCA3
{
}
Class _____
{
public static void main(String args[])
{
BCA3 b1 = new BCA3()
b1.show()
}
}

Perform the code to print table of 2 and solve the error.


Q_ 3 Rewrite the code after writing the missing code in the below given 2
code.
class First
{
static int a;

static void show()


{
System.out.println(“Value is “+a);
}

}
class Test
{
public static void main(String args[])
{
//Missing Code
}
}
Q_ 4 Complete the following code and generate the desired output with 4
one bike and one car information:
class Vehicle
{
String type; //two-wheel or four wheel
int noOfWheels;
String colour;
void setData(){...}
void showData(){...}
}
class Bike extends Vehicle
{
String company;
double price;
void setData(){...}
void showData(){...}
}
class Car extends Vehicle
{
String company;
double price;
void setData(){...}
void showData(){...}
}
.
Q_ 5 Rewrite the code after writing the missing code in the below given 4
code.

class First
{
int a=10;

First(int x)
{
a=x;
}

}
class Second extends First
{
int b;

// Missing Code

void showdata()
{
System.out.println("First Value is "+a);
System.out.println("Second Value is "+b);
}
}
class Test
{
public static void main(String args[])
{
Second s=new Second(4,5);
s.show();
s.showdata();
}
}
Q_ 6 Generate factorial of entered number using below code: 2
public class FactFind
{
public static void main(String args[])
{
int no;
long fact;
System.out.println("Enter number:");
no=sc.nextInt();
// Missing Statement
System.out.println("Factorial is:"+fact);
}
}
Q_7 Find the below mentioned code to search an element from given 2
array, identify missing codes and re-write complete code and
generate the given output:
public class ArySearch
{
public static void main(String args[])
{
int ary[]=new int[5];
int ele, flag=0;
Scanner sc=new Scanner(System.in);
System.out.println("Input 5 array elements:");
for(int i=0;i<4;i++)
ary[i]=sc.nextInt();

//missing code statements

if(flag==1)
System.out.println("Element is Found");
else
System.out.println("Element is Not Found");
}
}
Output:
Input 5 array elements:
10
20
30
40
50
Enter element to search: 40
Element is Found

Q_ 8 Consider the given below output and generate a code for the same: 2

String 1 is: RK University


String 2 is: Rajkot
Sub string 3 is: RK
Combined string 4 is: RK University Rajkot

You might also like