Professional Documents
Culture Documents
First Term Examination-2018 Max. Time: 2 Hrs
First Term Examination-2018 Max. Time: 2 Hrs
Question 2.
a) Which of the following are valid identifiers and why/why not: [2]
Data_rec _data , 1 data , my.file , switch
b) Arrange the following operators in ascending order based on the precedence: [2]
= , ++ , ^ , &
c) Given the following set of identifiers:
byte b ; char ch;
shortsh; intintval;
longlongval; float fl;
Identify the data type of the following expressions:
i) ’a’-3 [2]
ii) intval * longval –ch; [2]
iii) fl+ longval/sh [2]
Question 3.
a) Evaluate: [2]
int a, mb=2 , k=4 ;
a=mb*3/4+k/4+8-mn+5/8;
b) Rewrite the following by using switch-case statement: [2]
if (code==’A’)
System.out.println (“Accountant”);
else
if (code == ‘C’ || code==’G’)
System.out.println(“Grade IV”);
else
if(code==’F’)
System.out.println(“advisor”);
c) Differentiate between if-else and switch-case. [2]
d) Give output of the following: [2]
int a=5;
a + +;
System.out.println(a);
a−¿ ¿;
System.out.println(a);
e) What is the value of 1 , if x =5. [2]
x 1=++ x−x +++−−x ;
Question 4.
a) Briefly explain the terms: i) Softlifing ii) Software counterfeiting [2] b)
Briefly explain the terms: i) IP spoofing ii) Denial of service [2]
c) Differentiate between patent and copyright. [2]
d) Give the syntax of function definition. [2]
e) Define ‘Intellectual property right’. [2]
Given the amount deposited and the number of years, write a program to calculate the money in
the customer’s account at the end of the specified time.
Question 6.
Write a menu driven program to convert Fahrenheit to Celsius and Celsius to Fahrenheit. [10]
Question 7.
Write a program that takes three angles and states whether these angles form an
acute triangle or an obtuse angle or a right-angled triangle. [10]
Question 8.
Write a program by using function to convert the time in 24 hrs format to 12 hrs format. [10]
Question 9.
Write a java class to calculate the income tax by taking monthly salary of an employee based on
the following conditions: [10]
Member methods:
void input( ) – to input and store the detail of the customer.
void compute( ) –to compute the rental charge
Question 12.
Shasha Travels Pvt. Ltd. gives the following discount to its customers: [10]
Write a program to input the name and ticket amount for the customer and calculate the
discount amount and net amount to be paid. Display the name, discount and net amount.
*******************************************************************************