Csc 201-lecture Midterm

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Csc 201-lecture Midterm as PDF for free.

More details

  • Words: 272
  • Pages: 7
CSC 201 Lecture - 10

Agenda • Review for Midterm • Practice the Java methods and parameter passing in Java. • How to pass arrays as parameters in Java.

Midterm review 1) 2) 3) 4)

Questions on what is the output of the following part of code? Understanding of various loop constructs may be involved. Please refer quiz tests conducted in class. Understanding arrays, writing simple programs using arrays. Please practice and understand arrays we did in our lab sessions and our class notes. Refer to the questions behind the chapters in our textbook. Practice writing methods and passing parameters. (Very simple parameter passing will be covered)

• All material from (Data types to Static methods included) must be reviewed for midterm. • There will be 3 more homework and 4 more quizzes in our remaining semester. • There will be a final project instead of a final examination. You will be given 4 weeks to complete the project. • The above schedule may be subject to change but this is my tentative plan.

Arrays as Parameters Class sample_array{ public static void myarray(int[] b) { b[0] = 7; b[1] = 8; b[2] = 9; //return b; } public static void main(String[] args) { int[] a = {1, 2, 3}; myarray(a); System.out.println(a[0]+" "+a[1]+" "+a[2]); } }

Integer as parameter Class sample_integer { public static void pass_integer(int num) { System.out.println("I am in method pass_integer"); num = 5; System.out.println("Value of num is:"+num); } public static void main(String[] args) { int a; a = 2; pass_integer(a); System.out.println("Value of a after we return from method is:"+a); } }

• Try passing other primitive data types as parameter.

Related Documents

Csc
May 2020 19
Csc
October 2019 31
Csc
November 2019 34
Midterm
May 2020 23