This preview shows page 1 - 3 out of 5 pages.

KENYA METHODIST UNIVERSITY END OF FIRST TRIMESTER 2018 (PT) EXAMINATIONS SCHOOL : SCIENCE AND TECHNOLOGY DEPARTMENT : COMPUTER SCIENCE COURSE CODE : BBIT-223/CISY 210 COURSE TITLE : OBJECT ORIENTED PROGRAMMING TIME : 2 HOURS INSTRUCTIONS: Answer Question ONE and any other TWO Questions. Question One a) Define the following terms (2 Marks) i) Method overloading ii) Typecasting. b) What will the following program output? (6 marks) 1 publicclass Exam 2 { 3 staticvoid increment( int x) 4 { 5 x++; 6 System.out.println(x++); 7 System.out.println(x); 8 x--; 9 System.out.println(2*x); 10 } 11 12 publicstaticvoid main(String arg[]) 13 { 14 15 increment(4); 16 } 17 18 } c) Consider the table below: Page 1 of 5
Image of page 1

Subscribe to view the full document.

12 14 16 18 20 22 24 26 28 Assume that these values are stored in an array named mynumbers write only the for-loop that assigns values to this array. Do not assign the elements individually to each cell but you must use a for-loop and a predefined pattern to do this. (5 Marks) d) What does the keyword static mean in the method declaration in line 3, in the program in b?
Image of page 2
Image of page 3
  • Winter '15
  • Joyce Wambugu

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes