THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A

Similar documents
THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

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)

Chapter 4 Defining Classes I

Introduction to Programming Using Java (98-388)

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

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

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

Object Oriented Programming with Java. Unit-1

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR (ODD SEM)

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Exam Duration: 2hrs and 30min Software Design

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

Topic 5 Polymorphism. " Inheritance is new code that reuses old code. Polymorphism is old code that reuses new code.

What are the characteristics of Object Oriented programming language?

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

CSC207H: Software Design. Java + OOP. CSC207 Winter 2018

CMSC 331 Second Midterm Exam

EXPERIMENTS IN COMPUTER SCIENCE

Lecture 5: Methods CS2301

Core Java Syllabus. Pre-requisite / Target Audience: C language skills (Good to Have)

CO Java SE 8: Fundamentals

This page intentionally left blank

Java classes cannot extend multiple superclasses (unlike Python) but classes can implement multiple interfaces.

INSTITUTE OF AERONAUTICAL ENGINEERING

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

1. An operation in which an overall value is computed incrementally, often using a loop.

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

CS 11 java track: lecture 3

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION

Abstract Classes. Abstract Classes a and Interfaces. Class Shape Hierarchy. Problem AND Requirements. Abstract Classes.

Faculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions

Computer Programming: C++

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Object Orientated Analysis and Design. Benjamin Kenwright

Introduction to Java. Handout-1d. cs402 - Spring

CSC207H: Software Design. Java + OOP. CSC207 Winter 2018

SCHEME OF COURSE WORK

JAVA GUI PROGRAMMING REVISION TOUR III

C++ (Non for C Programmer) (BT307) 40 Hours

Core JAVA Training Syllabus FEE: RS. 8000/-

Keyword this. Can be used by any object to refer to itself in any class method Typically used to

IMACS: AP Computer Science A

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

15CS45 : OBJECT ORIENTED CONCEPTS

VALLIAMMAI ENGINEERING COLLEGE

5. Give any three parts of the structure of business letter.

Argument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

( &% class MyClass { }

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...

Java Programming Fundamentals

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE

WA1278 Introduction to Java Using Eclipse

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

Array Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

Intermediate Programming & Design (C++) Classes in C++

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

Internet Application Developer

Arrays. Comp Sci 1570 Introduction to C++ Array basics. arrays. Arrays as parameters to functions. Sorting arrays. Random stuff

Week 7 - More Java! this stands for the calling object:

Object Oriented Programming

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

8. Functions (II) Control Structures: Arguments passed by value and by reference int x=5, y=3, z; z = addition ( x, y );

Midterm Exam CS 251, Intermediate Programming March 12, 2014

1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'

Java Object Oriented Design. CSC207 Fall 2014

PROGRAMMING LANGUAGE 2

COMP200 - Object Oriented Programming: Test One Duration - 60 minutes

Inheritance and Polymorphism

Polymorphism. Zimmer CSCI 330

Object Oriented Programming: Based on slides from Skrien Chapter 2

(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University

Programs as Models. Procedural Paradigm. Class Methods. CS256 Computer Science I Kevin Sahr, PhD. Lecture 11: Objects

SRM INSTITUTE OF SCIENCE & TECHNOLOGY Faculty of Science and Humanities Department of Computer Science UNIT I - INTRODUCTION TO JAVA

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Full file at

Java Application Development

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

Venkateshwar International School Sector-18, Dwarka, New Delhi-78 SAT- PRELIMINARY ROUND Class XII

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

OVERRIDING. 7/11/2015 Budditha Hettige 82


ABOUT CORE JAVA COURSE SCOPE:

CS313D: ADVANCED PROGRAMMING LANGUAGE

CHOICE BASED CREDIT SYSTEM (With effect from )

Compaq Interview Questions And Answers

An Object Oriented Programming with C

Day 4. COMP1006/1406 Summer M. Jason Hinek Carleton University

Midterm assessment - MAKEUP Fall 2010

Transcription:

THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A MAIN EXAMINATION P.O. Box 62157 00200 Nairobi - KENYA Telephone: 891601-6 Fax: 254-20-891084 E-mail:academics@cuea.edu AUGUST - DECEMBER 2015 TRIMESTER FACULTY OF SCIENCE DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE Date: DECEMBER 2015 REGULAR PROGRAMME CMT 303: OBJECTIVE ORIENTED PROGRAMMING II Duration: 2 Hours INSTRUCTIONS: Answer Question ONE and ANY other TWO Questions Q1. a) What is the fundamental difference between the object oriented and procedural paradigms? b) What steps are involved in running an applet under the control of a web browser? In what ways does running a java applet differ from running a java application. c) What is the loop and a half problem? Explain TWO strategies for solving it. (6 marks) d) Define the following terms as they relate to methods: call argument, return. e) In java, what does the keyword this signify? In what two contexts is it used? f) Write declarations that create: i An array double Array consisting of 100 values of type double. (1 mark) Cuea/ACD/EXM/AUGUST - DECEMBER 2015/COMP SCIENCE Page 1

ii An array of objects in use to store names and marks of students in the unit OOP. (2 marks) iii An array lines consisting of 50 strings. (2 marks) g) Write the variable declaration and for loop necessary to create and initialize the following integer array. (5 marks) Squares 0 1 4 9 16 25 36 49 64 81 100 121 0 1 2 3 4 5 6 7 8 9 10 11 Q2. a) What are some of the advantages of using the array list class as opposed to java arrays? b) If X = 5, y = 6, Z = 4 and W = 3.5 evaluate each of the following expressions, if possible. If it is not possible, i (I + z) % y (2 marks) ii (x+y ) % w (2 marks) iii (y + w ) % x (2 marks) iv (x + y ) * w (2 marks) v (x % y ) % z (2 marks) vi (y % z ) % x (2 marks) vii (x * z) % y (2 marks) viii ((x * y) * w* z (2 marks) Q3. a) Suppose that you have the following declaration: int I = o; The output of the statement: If ((8 > 4) //(j + + ==7)) System. Out.print in ( j = = + j); Is : j = o While the output of the statement If ((8 > 4) / (j++ = =7)) System.print ( j = + ); Is : j = 1 Required: Explain why b) Show the output of the following program: Public class mystery class Public static void main (string [ ] avgs) Cuea/ACD/EXM/AUGUST - DECEMBER 2015/COMP SCIENCE Page 2

Int n; For (n = 1; n < = 5; n ++) System.out.printin (mystery (n)); Public static int mystery (int k) Int x, y; For (x = 1; x < = (k-1) ; x ++ Y = y * (k-x) ; Return y ; (5 marks) c) Assuming that myflag is declared as a boolean variable what is the problem with writing the following if statement if (myflag = = true). d) Explain in your own words the difference between a method and a program. What is the connection between them? (2 marks) e) Using examples,demonstrate the usefulness of the following OOP concepts i Inheritance ii Polymorphism iii Information hiding. f) How do you tell whether two strings contain the same characters? Q4. a) What is the relationship between arguments and formal parameters? b) What is the role of the javadoc documentation system? c) What is the result of calling character.is Digit (5)? What is the result of calling character.isdigit( 5 )? Is it legal to call character.isdigit( 5 )? Why? Cuea/ACD/EXM/AUGUST - DECEMBER 2015/COMP SCIENCE Page 3

d) In the following code, correct any errors that would prevent the program from compiling or running public class Errors Made Public static void main (string [ ] args) Int a, b; Booblean found; System.print ( Enter the first integer); a = console.nextin () ;; System.print (n(); Systems.out.printin( Enter the second integer); b = console.nextint();; if a > *b && 10<b found = 2* a> b; else found = 2* a < b; if found a = 3; c = 15; if b b = o; a = 1; else found = 2 * a < b; If found a = 3 c =15; if b b = 0; a = 1; Cuea/ACD/EXM/AUGUST - DECEMBER 2015/COMP SCIENCE Page 4

Q5. a) Explain the differences between AWT and swift components. b) Explain the similarities and differences between abstract classes and interfaces. When would it be appropriate to use one and not the other? c) By use of example java snippets differentiate between method overloading and method overriding. d) List and describe any TWO swing layouts for graphical user interfaces. e) List and explain the FOUR components of JDBC. *END* Cuea/ACD/EXM/AUGUST - DECEMBER 2015/COMP SCIENCE Page 5