Higher National Diploma in Information Technology First Year, Second Semester Examination 2015

Similar documents
An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a

Introduction to Programming Using Java (98-388)

SRI LANKA INSTITUTE OF ADVANCED TECHNOLOGICAL EDUCATION

IT 1003 Introduction to Programming (New)

Module 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

CSC 1051 Algorithms and Data Structures I. Midterm Examination March 2, Name:

Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering. Fifth Semester

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

Name of subject: JAVA PROGRAMMING Subject code: Semester: V ASSIGNMENT 1

Higher National Diploma in Information Technology

First Name: AITI 2004: Exam 2 July 19, 2004

Object Oriented Programming with Java. Unit-1

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 9, Name: KEY

CSC Java Programming, Fall Java Data Types and Control Constructs

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction

CS1004: Intro to CS in Java, Spring 2005

Overview. Applets. A Java GUI inside your browser! Important methods Drawing images Playing audio Getting input parameters Double buffering

CSC Algorithms and Data Structures I. Midterm Examination February 25, Name:

McGill University School of Computer Science COMP-202A Introduction to Computing 1

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177. Programming

CSIS 10A Test 2 Name:_SOLUTIONS

Chapter 2 Using Objects. Types. Number Literals. A type defines a set of values and the operations that can be carried out on the values Examples:

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 7, Name:

Following is the general form of a typical decision making structure found in most of the programming languages:

CSC 1051 Algorithms and Data Structures I. Final Examination May 12, Name


(2½ hours) Total Marks: 75

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Chapter 7 Applets. Answers

CSC 1051 Algorithms and Data Structures I. Midterm Examination February 25, Name: KEY A

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3 Hours Full Marks: 70

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.

First Name: AITI 2004: Exam 2 July 19, 2004

Chapter 3 - Introduction to Java Applets

Java - Applets. public class Buttons extends Applet implements ActionListener

Chapter 5 - Methods Prentice Hall, Inc. All rights reserved.

Final Examination Semester 2 / Year 2012

COMPUTER APPLICATIONS

POST GRADUATE DIPLOMA IN LIBRARY AUTOMATION AND NETWORKING (PGDLAN)

Question 1. Show the steps that are involved in sorting the string SORTME using the quicksort algorithm given below.

Defining Classes and Methods

Chapter 12 Advanced GUIs and Graphics

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017

Methods (Deitel chapter 6)

Introduction to Computer Science I

Methods (Deitel chapter 6)

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Defining Classes and Methods. Objectives. Objectives 6/27/2014. Chapter 5

G51PRG: Introduction to Programming Second semester Applets and graphics

Data Representation and Applets

CSC 1051 Algorithms and Data Structures I. Final Examination May 12, Name: KEY. Question Value Score

BSc. (Hons.) Software Engineering. Examinations for / Semester 2

Possible Exam Questions

1 Getting started with Processing

Course Outline. Introduction to java

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B

Java 1.8 Programming

S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics

Objectives. Defining Classes and Methods. Objectives. Class and Method Definitions: Outline 7/13/09

CSC 111, Test 1 (Fall 2009)

BEng (Hons) Electronic Engineering. BEng (Hons) Telecommunications. Examinations for / Semester 2

Applets and the Graphics class

Higher National Diploma in Information Technology Second Year, First Semester Examination HNDIT 310l-Rapid Application Development.

COMPUTER APPLICATIONS

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

Chapter 14: Applets and More

8/23/2014. Chapter Topics. Introduction to Applets. Introduction to Applets. Introduction to Applets. Applet Limitations. Chapter 14: Applets and More

A JavaBean is a class file that stores Java code for a JSP

Activity 3: Data Types

CS 113 PRACTICE FINAL

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

CompSci 125 Lecture 07. Chapter 4: Object-Oriented Development

CSC 1051 Algorithms and Data Structures I. Midterm Examination February 26, Name: Key

System.out.print(); Scanner.nextLine(); String.compareTo();

JAVA Swings Sample Codes CODE NO: EduLanka Sample Java Codes - ONLINE JAVA

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );

Core JAVA Training Syllabus FEE: RS. 8000/-

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 6, Name:

Problem Grade Total

Use the scantron sheet to enter the answer to questions (pages 1-6)

1 OBJECT-ORIENTED PROGRAMMING 1

An Introduction to Processing

RAIK 183H Examination 2 Solution. November 10, 2014

CIS 110 Introduction to Computer Programming. February 29, 2012 Midterm

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA

CSE 11 Midterm Fall 2008

Data Representation and Applets

COMPUTER APPLICATIONS

Data Representation and Applets

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

1 Short Answer (10 Points Each)

Introduction to Java

Transcription:

[All Rights Reserved] SLIATE SRI LANKA INSTITUTE OF ADVANCED TECHNOLOGICAL EDUCATION (Established in the Ministry of Higher Education, vide in Act No. 29 of 1995) Higher National Diploma in Information Technology First Year, Second Semester Examination 2015 HNDIT1209 / IT 2001- Object Oriented Programming / Programming in JAVA Instructions for Candidates: No. of questions : 06 Answer five (05) questions only No. of pages : 07 All questions carry equal marks. Time : Three (03) hours Question 01 (i) Write the default value of given data types in JAVA. a. byte b. int c. String d. boolean (ii) Write the output of the following code segments. a. int x = 2; System.out.print(x +"!= "); System.out.println(2*x); b. System.out.print("\"Hello\\\n Ann!"); c. int break = 3; System.out.print(--break);

(iii) Evaluate the following expressions for x=2, y=5 and z=9 a. x + y * 5 z b. (z/x )+ y/2 + x/2 c. z%5 + 5*3+1 (iv) What is data type conversion? Explain with an example. Question 02 (i) Rewrite the given code segment with only one if statement. if(attendance >= 80) if(assignmmentmarks >= 40) eligibility = true; (ii) Consider given code segment. int number = 2; Design a SWITCH to display bellow result. Value of number variable Display message 1 Number is One 2 Number is Two Any other value Number is not defined (iii) Write general syntax of Do While loop. (iv) Write a complete JAVA program to display Summation of Even numbers between 0 and 100 using a for loop. (0 and 100 are not included) 2

Question 03 (i) What is an Array? (ii) Write the code segments to perform following tasks. a. Create a String array named days which can hold 7 String values. b. Create a char array named vowels and initialize it. (Either capital letters or simple letters) c. Print the second element in the following integer array. Array name is score. 4 5 6 9 1 8 7 2 d. Replace the value 7 with the value 9 in the following integer array. Array name is score. 4 5 6 9 1 8 7 2 (iii) Write answers to question a to c by considering the given JAVA code segment. String x="i love Java Programming"; a. What is the output of the following code? System.out.println(x.charAt(5)); b. Write the line of code to get the number of characters in the above string. c. What would be the output of following code segment? System.out.println(x.subString(1,4)); 3

(iv) Consider the given code segment. String x="i love Java Programming"; String y ="I love Java"; Write the code segment to compare two variables (x and y). If x and y variables have same value display a message same otherwise display a message different. Question 04 (i) Consider the following scenario. You are asked to design a cylinder class using JAVA language to keep records on cylinders manufactured by a company. The company needs to store the cylinder color, radius and height for each cylinder. Design the cylinder class with following properties. a. Encapsulated instance variables: color, radius and height. b. Constructor of the class to initialize encapsulated variables with passing arguments from calling program. c. Public getcolor method to return the color of the cylinder. (03 marks) (03 marks) d. Public displayvolume method to calculate the volume of the cylinder and print it. (Volume of a Cylinder = (22/7) * radius 2 * height) e. Write the code segment to create an instance of the cylinder class passing following values for the instance variables. color = red, radius = 7.0, height = 20.0 4

(ii) What is an Exception in JAVA? (iii) Write a Java code using try catch blocks to handle the exception when trying to access an array index out of its range. (4 marks) Question 05 (i) Consider given code segment. (Read the comment carefully) abstract class Shape { // Shape contains abstract methods only a. Can you create an object using Shape class? b. Explain your answer. (ii) Write a JAVA code segment to design a class named as CheckingAccount using the bellow interface. (You are not expected to define body of the CheckingAccount class) public interface BankAccount { // Code here (iii) Write answers to a and b from the given code segment. public class Ati extends Sliate { // Code here a. What is the name of Supper Class? 5

b. What is the name of Sub Class? (iv) When methods are overloaded, explain how JAVA would select matching method. (v) What are the stages of Thread Life Cycle in JAVA? (vi) Name a class or an interface which can be used to create a thread in JAVA. Question 06 (i) You are given App.class applet file. You would be asked to display that in your web browser 300 pixels width and 250 pixels height screen. Write the suitable HTML tag(s) with attribute values to display your applet. (You are not expected to write complete HTML file) (ii) Write a JAVA code segment to draw a Line between (10, 10) and (50, 50) coordinates. (Hint: Use bellow incomplete JAVA code segment) import java.awt.*; import javax.swing.*; public class App2 extends JApplet { public void paint(graphics g) { // Code here 6

(iii) Write complete JAVA codes to display given user interface. (10 marks) ----END---- 7