UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614

Size: px
Start display at page:

Download "UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614"

Transcription

1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 DATE: 7 May 2015 MARKS: 130 ASSESSOR: Prof. P.J. Blignaut (Bonus marks: 5) MODERATOR: Dr. L. de Wet TIME: 180 minutes SECTION A (61) Answer the following questions in the answer book that is provided. The computer must be switched off while you are busy with Section A. 1.1 Which one of the following is not a method or method call? A. event handler B. constructor C. property D. Click() E. Main() 1.2 When a user is asked a question, Another one?, in a while loop to end execution of the loop, it is called a loop. A. state-controlled B. nested while C. sentinel-controlled D. counter-controlled E. infinite 1.3 Which one of the following are important with regard to parameters in a method call? A. Sequence, type and number B. Reference, number and type C. Return type, sequence and number D. Access modifier, return type and method name 1.4 How can the compound conditional expression ( (average > 79) && (average <= 89) ) be written to eliminate the logical operator, without changing the logic? A. remove the && and create a nested if statement B. (average > 79 <= 89) C. by replacing the && with D. (79 > average <= 89) E. (79 < average <= 89) 1.5 What value is stored in ianswer after the following expression is evaluated? int i = 6; int k = 3; int ianswer = 10; ianswer *= ++i + k++; A. 9 B. 10 C. 90 D. 100 E. 110

2 2 2. Explain the difference between each one of the following pairs of terminology: 2.1 Syntax errors and logic errors (2) 2.2 Step over and step into while debugging a program in Visual Studio (2) 2.3 Pre-test and post-test loops (2) 2.4 Static methods and instance methods (2) 2.5 public and private access modifiers (2) 2.6 Actual parameters and formal parameters (2) 2.7 Value parameters and reference parameters. (2) 3. Identify each of the underlined elements in the following lines of code. You may choose from the following list: assignment, access modifier, value parameter, constructor call, reference parameter, event, return type, variable, method call, method definition 3.1 private int Calculate (ref int inum1, int inum2) (1) 3.2 private int Calculate (ref int inum1, int inum2) (1) 3.3 private int Calculate (ref int inum1, int inum2) (1) 3.4 private int Calculate (ref int inum1, int inum2) (1) 3.5 private int Calculate (ref int inum1, int inum2) (1) 4. Write down the output of the following code: 4.1 static void Main(string[] args) int inum1 = 4; int inum2 = inum1; int ivalue = Calculate(ref inum1, inum2); Console.WriteLine("The result of the calculation of 0 and 1 is 2.", inum1, inum2, ivalue); private int Calculate(ref int _inum1, int _inum2) _inum1 *= _inum1; return _inum1 + _inum2; (3) 4.2 int a = 5; a %= 3; Console.WriteLine(a); (1) 4.3 int a = 1; int b = 1; Console.WriteLine(a!= b); (1) 4.4 int a = 1; int b = 1; Console.WriteLine(a <= b); (1) 4.5 double x = 3.0, y = 2.0; Console.WriteLine( (x + y x * y % 3).ToString() ); (1) 4.6 int x = 3, y = 2; Console.WriteLine(y%x); (1) 4.7 int a = 23; Console.WriteLine(a/5); (1)

3 3 5. Consider the following program fragment: 1 static void Main(string[] args) 2 3 string sf; 4 do 5 6 Console.Clear(); 7 Console.Write("Degrees Fahrenheit ('X' to exit) : "); 8 sf = Console.ReadLine(); 9 if (sf.toupper()!= "X") double F; 12 if (double.tryparse(sf, out F)) double C = (F - 32) / 1.8; 15 Console.WriteLine(F.ToString() + (char)176 + "F = " + C.ToString("0.0") + (char)176 + "C"); Console.WriteLine("Invalid input"); 19 Console.Write("Press any key to enter another value... "); 20 Console.ReadKey(); while (sf.toupper()!= "X"); 23 //Main 5.1 Describe the general purpose of the program. (2) 5.2 Why is sf declared in line 3 and not in line 8? (1) 5.3 What is the purpose of line 6? (1) 5.4 Explain in full what line 12 does. (4) 5.5 What is the purpose of (char)176 in line 15? (1) 5.6 What is the purpose of "0.0" in line 15? (2) 5.7 Explain the working of the do while ( ) structure as it is used in this program. What type of loop is this? (3) 5.8 Write down the exact output as printed by line 15 if the user enters 32 as input. (2) 5.9 What will the output be if the user enters "x" as input in line 8? (1) 5.10 What will the output be if line 20 is omitted? (1) 6. A prime number is an integer with no factors besides 1 and itself. Develop a flowchart to determine if a given number is a prime number. You may use Visio if you want to. (10) Dec Hex A B C D E F Bin sp! # $ % & ( ) * +, -.. / : ; < = >? 64 4 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _` ` a b c d e f g h i j k l m n o p q r s t u v w x y z ~ , ˆ Š Œ š œ ž Ÿ 160 A 1010 ª «176 B 1011 ± ² ³ µ ¹ º» ¼ ½ ¾ 192 C 1100 À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï 208 D 1101 Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß 224 E 1110 à á â ã ä å æ ç è é ê ë ì í î ï 240 F 1111 ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ

4 4 NB. You must submit Section A before you may switch on the computer to do Section B. SECTION B (74) Create a folder for CSIS1614 on the T-drive. te that this is not an open-book test. Question 1 (18) Create a new Console application in the folder T:\Studentnumber_Surname\Question1. Name the application Question1 and make sure that you check the Create directory for solution checkbox. The application should allow the user to enter his name and age. Make provision for invalid input. Depending on the user s age, the program must then display a message as in the example below according to the following scheme: 0 12 : Child : Teenager : Young adult : Adult > 65 : Pensioner Example: Name: John Age : 23 Good day, John! You are a young adult. Press any key to exit... Question 2 (10) Create a new Console application in the folder T:\Studentnumber_Surname\Question2. Name the application Question2 and make sure that you check the Create directory for solution checkbox. The application should calculate the squares and cubes of the numbers from 1 to 10 and prints the resulting values in table format, as shown below All calculations should be done in terms of a counter x of a for-loop. Ensure that the values in each column are right-aligned.

5 5 Question 3 (21) In Gymnastics and many other sports where judges award a subjective point for an activity, it is custom to disregard the lowest and highest points and allocate the average of the remaining points to the athlete. The user must be able to decide how many judges there are as long as it is at least three. Create a new Console application in Visual Studio in the folder T:\Studentnumber_Surname\ Question3. Name the application Question3 and make sure that you check the Create directory for solution checkbox. Consider the following flowchart and example output and develop the C# application to solve the problem. error handling is expected. Start Number of judges Number of judges >= 3? i = 1 Min=11 Max = -1 Total = 0 i<=number of judges? Enter point Subtract min Add point to total Subtract max Point>Max? Max = Point Calculate average Point<Min? Min = Point Display average i++ End

6 6 Question 4 (25) Create a new Console application in the folder T:\Studentnumber_Surname\ Question4. Name the application Question4 and make sure that you check the Create directory for solution checkbox. The application should calculate the area of two dimensional geometrical figures. You should first ask a user if he/she wants to calculate the area of a rectangle or circle. Depending on his/her choice, an appropriate method should be called to get the input parameters (radius or length and width), calculate and display the area. You should guard against repetition of similar lines of code. The formulas for the area of the respective figures must be implemented in different overloaded methods. The methods must receive the inputs through value parameters and return a double with the area of the figure. Make provision for invalid input.

7 7 MEMORANDUM Section A 1.1 C 1.2 A 1.3 A 1.4 A 1.5 D 2.1 Syntax errors occur when the rules of the language are transgressed. Logic errors occur when program compiles but the output is wrong. 2.2 Step over (F10) does not go into method when a method call is reached. Step into (F11) goes into a method when it is called. 2.3 Pre-test: Condition tested before the loop is entered. Post-test: Condition tested after loop execution. 2.4 Static method belongs to a class. Instance method belongs to an object. 2.5 Public methods are available to other classes also. Private method is only available in the class where it is declared. 2.6 Actual parameter: In the method call. Formal parameter: In the method header. Part of signature. 2.7 Value parameter: Value is copied from the actual to the formal parameter. Reference parameter: Actual and formal parameters point to the same memory cell. 3.1 access modifier 3.2 return type 3.3 method definition 3.4 reference parameter 3.5 value parameter 4.1 "The result of the calculation of 16 and 4 is 20." False 4.4 True Allow the user to enter degrees Fahrenheit and convert to degrees Celsius. 5.2 Scope of line 22 is outside the loop. 5.3 Clear the console window after previous entry. 5.4 Convert string variable to double if possible. Assign numeric value to F if possible, assign 0. Continue with conversion to Celsius if the string is valid numeric. 5.5 Prints the character in the UTF table with numeric value 176 ( ). 5.6 Formats the output to one decimal digit. 5.7 User can enter Fahrenheit values until he is done. Then enter "X" to exit the loop. Post-test, sentinel controlled loop. 5.8 "32 F = 0.0 C" 5.9 output. Program will exit User will not have opportunity to read output. Console will be cleared and user prompted for next input.

8 8 6. Start Read Number isprime = true ifactor = 2 isprime && Factor < SQRT(Number) isprime Number divisible by Factor Prime t prime Increment factor isprime = false End

9 9 Section B Question 1 (18) static void Main(string[] args) //Input Console.Write("Name: "); string sname = Console.ReadLine(); Console.Write("Age : "); try int iage = int.parse(console.readline()); Console.WriteLine(); //Output if (iage <= 12) Console.WriteLine("Good day, " + sname + "! You are a child."); if (iage <= 19) Console.WriteLine("Good day, " + sname + "! You are a teenager."); if (iage <= 25) Console.WriteLine("Good day, " + sname + "! You are a young adult."); if (iage <= 65) Console.WriteLine("Good day, " + sname + "! You are an adult."); Console.WriteLine("Good day, " + sname + "! You are a pensioner."); catch Console.WriteLine("Invalid input."); Console.Write("\nPress any key to exit..."); Console.ReadKey(); Question 2 (10) static void Main(string[] args) for (int x = 1; x <= 10; x++) Console.WriteLine(x.ToString().PadLeft(4, ' ') + "\t" + (x * x).tostring().padleft(4, ' ') + "\t" + (x * x*x).tostring().padleft(4, ' ')); Console.ReadKey(); //Main

10 10 Question 3 (21) Question 4 (25) static void Main(string[] args) Console.WriteLine(); //Get number of judges int n = 0; do Console.Write("\tNumber of judges: "); n = int.parse(console.readline()); while (n < 3); //Initialise int imin = 11; int imax = -1; int itotal = 0; //Get input from judges for (int i = 1; i <= n; i++) Console.Write("\tPoint " + i + " : "); int ipoint = int.parse(console.readline()); itotal += ipoint; if (ipoint > imax) imax = ipoint; if (ipoint < imin) imin = ipoint; //Subtract min and max and calculate average itotal = itotal - imax - imin; double davg = itotal * 1.0 / (n - 2); //Display output Console.WriteLine("\tFinal point : " + davg.tostring("0.0")); //Opportunity to read output Console.Write("\n\tPress any key to exit..."); Console.ReadKey(); //Main class Program static void Main(string[] args) Console.Write("Rectangle (R), Circle (C) :"); char cchoice = Console.ReadKey().KeyChar; Console.WriteLine(); Console.WriteLine(); switch (cchoice) case 'R': Rectangle(); break; case 'C': Circle(); break; Console.Write("Press any key to exit..."); Console.ReadKey(); //Main

11 11 private static double Area(double _dlength, double _dwidth) return _dlength * _dwidth; //Area private static double Area(double _dradius) return Math.PI * _dradius * _dradius; //Area private static void Rectangle() bool isvalid = true; double dwidth=0, dlength=0; string smsg; Console.Write("Width : "); isvalid = isvalid && double.tryparse(console.readline(), out dwidth) && dwidth > 0; Console.Write("Length : "); isvalid = isvalid && double.tryparse(console.readline(), out dlength) && dlength > 0; if (isvalid) double darea = Area(dLength, dwidth); smsg = string.format("area : 0:F2", darea); smsg = "Invalid input."; Console.WriteLine(sMsg); //Rectangle private static void Circle() bool isvalid; double dradius = 0; string smsg; Console.Write("Radius : "); isvalid = double.tryparse(console.readline(), out dradius) && dradius > 0; if (isvalid) double darea = Area(dRadius); smsg = string.format("area : 0:F2", darea); smsg = "Invalid input."; Console.WriteLine(sMsg); //Circle //class Program

Answer the following questions on the answer sheet that is provided. The computer must be switched off while you are busy with Section A.

Answer the following questions on the answer sheet that is provided. The computer must be switched off while you are busy with Section A. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 DATE: 25 April 2013 TIME: 180 minutes MARKS: 100 ASSESSORS: Prof. P.J. Blignaut & Mr. F. Radebe (+2 bonus marks) MODERATOR:

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36)

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36) UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 DATE: 5 March 2015 MARKS: 100 ASSESSOR: Prof. P.J. Blignaut TIME: 180 minutes MODERATOR: Dr. L. de Wet SECTION A (36)

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70 ASSESSOR: Prof. P.J. Blignaut (+1 bonus mark) This

More information

Lecture 5 C Programming Language

Lecture 5 C Programming Language Lecture 5 C Programming Language Summary of Lecture 5 Pointers Pointers and Arrays Function arguments Dynamic memory allocation Pointers to functions 2D arrays Addresses and Pointers Every object in the

More information

UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Additional Half Year Examination 2016 ASSESSORS: Prof. P.J. Blignaut

More information

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed.

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 124 DATE: 5 September 2011 TIME: 3½ hours MARKS: 150 ASSESSORS: Prof. P.J. Blignaut & Mr. M.B. Mase MODERATOR: Dr. A. van

More information

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed.

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 124 DATE: 1 September 2014 TIME: 3 hours MARKS: 105 ASSESSORS: Prof. P.J. Blignaut BONUS MARKS: 3 MODERATOR: Dr. L. De Wet

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1 DATE: 12 March 2014 TIME: 4 hours MARKS: 220 ASSESSORS: Prof. P.J. Blignaut & Mr G.J. Dollman BONUS MARKS:

More information

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Main End-of-year Examination 2013 PAPER 1 ASSESSORS: Prof. P.J.

More information

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC This update to the AppleShare PC User's Guide discusses AppleShare PC support for the use of international character sets, paper sizes, and date

More information

Pointers. CS2023 Winter 2004

Pointers. CS2023 Winter 2004 Pointers CS2023 Winter 2004 Outcomes: Introduction to Pointers C for Java Programmers, Chapter 8, sections 8.1-8.8 Other textbooks on C on reserve After the conclusion of this section you should be able

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 DATE: 13 May 2016 TIME: 3.5 hours MARKS: 112 ASSESSOR: Prof. P.J. Blignaut BONUS MARKS: 5 MODERATOR:

More information

This file contains an excerpt from the character code tables and list of character names for The Unicode Standard, Version 3.0.

This file contains an excerpt from the character code tables and list of character names for The Unicode Standard, Version 3.0. Range: This file contains an excerpt from the character code tables and list of character names for The Unicode Standard, Version.. isclaimer The shapes of the reference glyphs used in these code charts

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Personal Conference Manager (PCM)

Personal Conference Manager (PCM) Chapter 3-Basic Operation Personal Conference Manager (PCM) Guidelines The Personal Conference Manager (PCM) interface enables the conference chairperson to control various conference features using his/her

More information

Class Test 10. Question 1. Create a console application using visual studio 2012 ultimate.

Class Test 10. Question 1. Create a console application using visual studio 2012 ultimate. Class Test 10 Question 1 Create a console application using visual studio 2012 ultimate. Figure 1 Use recursion to create a menu, DO NOT use a while, do while or for loop. When any value is entered that

More information

ERNST. Environment for Redaction of News Sub-Titles

ERNST. Environment for Redaction of News Sub-Titles ERNST Environment for Redaction of News Sub-Titles Introduction ERNST (Environment for Redaction of News Sub-Titles) is a software intended for preparation, airing and sequencing subtitles for news or

More information

Object Oriented Programming with Visual Basic.Net

Object Oriented Programming with Visual Basic.Net Object Oriented Programming with Visual Basic.Net By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend (c) Copyright 2007 to 2015 H. Hakimzadeh 1 What do we need to learn in order

More information

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. The Increment and Decrement Operators

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. The Increment and Decrement Operators Chapter 5: 5.1 Looping The Increment and Decrement Operators The Increment and Decrement Operators The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++;

More information

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

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail. OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce

More information

Cartons (PCCs) Management

Cartons (PCCs) Management Final Report Project code: 2015 EE04 Post-Consumer Tetra Pak Cartons (PCCs) Management Prepared for Tetra Pak India Pvt. Ltd. Post Consumer Tetra Pak Cartons (PCCs) Management! " # $ " $ % & ' ( ) * +,

More information

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

1. Which of the following is the correct expression of character 4? a. 4 b. 4 c. '\0004' d. '4' Practice questions: 1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4' 2. Will System.out.println((char)4) display 4? a. Yes b. No 3. The expression "Java

More information

Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING

Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING MULTIPLE SELECTION To solve a problem that has several selection, use either of the following method: Multiple selection nested

More information

Example: Monte Carlo Simulation 1

Example: Monte Carlo Simulation 1 Example: Monte Carlo Simulation 1 Write a program which conducts a Monte Carlo simulation to estimate π. 1 See https://en.wikipedia.org/wiki/monte_carlo_method. Zheng-Liang Lu Java Programming 133 / 149

More information

Programming for Engineers Iteration

Programming for Engineers Iteration Programming for Engineers Iteration ICEN 200 Spring 2018 Prof. Dola Saha 1 Data type conversions Grade average example,-./0 class average = 23450-67 893/0298 Grade and number of students can be integers

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

Repetition Structures

Repetition Structures Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements

More information

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.

Condition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution. Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes

More information

Object Oriented Programming in C#

Object Oriented Programming in C# Introduction to Object Oriented Programming in C# Class and Object 1 You will be able to: Objectives 1. Write a simple class definition in C#. 2. Control access to the methods and data in a class. 3. Create

More information

Computer Programming C++ (wg) CCOs

Computer Programming C++ (wg) CCOs Computer Programming C++ (wg) CCOs I. The student will analyze the different systems, and languages of the computer. (SM 1.4, 3.1, 3.4, 3.6) II. The student will write, compile, link and run a simple C++

More information

Repe$$on CSC 121 Fall 2015 Howard Rosenthal

Repe$$on CSC 121 Fall 2015 Howard Rosenthal Repe$$on CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while

More information

Getting round your Mac with Shortcut Keys

Getting round your Mac with Shortcut Keys The Mac has many useful keyboard shortcuts but these do depend on you knowing the difference between the following keys: Shift Fn Ctrl Alt (Also referred to as Option) Command (Also referred to as the

More information

124 DISTO pro 4 / pro 4 a-1.0.0zh

124 DISTO pro 4 / pro 4 a-1.0.0zh 0 30 40 50 DISTO PD-Z01 14 DISTO pro 4 / pro 4 a-1.0.0 DISTO pro 4 / pro 4 a-1.0.0 15 16 DISTO pro 4 / pro 4 a-1.0.0 DISTO pro 4 / pro 4 a-1.0.0 17 1 PD-Z03 3 7 4 5 6 10 9 8 18 DISTO pro 4 / pro 4 a-1.0.0

More information

Banner 8 Using International Characters

Banner 8 Using International Characters College of William and Mary Banner 8 Using International Characters A Reference and Training Guide Banner Support January 23, 2009 Table of Contents Windows XP Keyboard Setup 3 VISTA Keyboard Setup 7 Creating

More information

Adorn. Serif. Smooth. v22622x. user s guide PART OF THE ADORN POMANDER SMOOTH COLLECTION

Adorn. Serif. Smooth. v22622x. user s guide PART OF THE ADORN POMANDER SMOOTH COLLECTION s u Adorn f Serif Smooth 9 0 t v22622x user s guide PART OF THE ADORN POMANDER SMOOTH COLLECTION v font faq HOW TO INSTALL YOUR FONT You will receive your files as a zipped folder. For instructions on

More information

Repetition CSC 121 Fall 2014 Howard Rosenthal

Repetition CSC 121 Fall 2014 Howard Rosenthal Repetition CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while

More information

COP 2000 Introduction to Computer Programming Mid-Term Exam Review

COP 2000 Introduction to Computer Programming Mid-Term Exam Review he exam format will be different from the online quizzes. It will be written on the test paper with questions similar to those shown on the following pages. he exam will be closed book, but students can

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

III. CLAIMS ADMINISTRATION

III. CLAIMS ADMINISTRATION III. CLAIMS ADMINISTRATION Insurance Providers: Liability Insurance: Greenwich Insurance Company American Specialty Claims Representative: Mark Thompson 142 N. Main Street, Roanoke, IN 46783 Phone: 260-672-8800

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All for repetition statement do while repetition statement switch multiple-selection statement break statement continue statement Logical

More information

RIS214. Class Test 3

RIS214. Class Test 3 RIS214 Class Test 3 Use console applications to solve the following problems and employ defensive programming to prevent run-time errors. Every question will be marked as follows: mark = copied? -5 : runs?

More information

Pointers & Arrays. CS2023 Winter 2004

Pointers & Arrays. CS2023 Winter 2004 Pointers & Arrays CS2023 Winter 2004 Outcomes: Pointers & Arrays C for Java Programmers, Chapter 8, section 8.12, and Chapter 10, section 10.2 Other textbooks on C on reserve After the conclusion of this

More information

Methods: A Deeper Look

Methods: A Deeper Look 1 2 7 Methods: A Deeper Look OBJECTIVES In this chapter you will learn: How static methods and variables are associated with an entire class rather than specific instances of the class. How to use random-number

More information

Chapter 2. Elementary Programming

Chapter 2. Elementary Programming Chapter 2 Elementary Programming 1 Objectives To write Java programs to perform simple calculations To obtain input from the console using the Scanner class To use identifiers to name variables, constants,

More information

HoneyBee User s Guide

HoneyBee User s Guide HoneyBee User s Guide font faq HOW TO INSTALL YOUR FONT You will receive your files as a zipped folder. For instructions on how to unzip your folder, visit LauraWorthingtonType.com/faqs/. Your font is

More information

Repe$$on CSC 121 Spring 2017 Howard Rosenthal

Repe$$on CSC 121 Spring 2017 Howard Rosenthal Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1 DATE: 18 March 2016 MARKS: 165 ASSESSOR: Prof. P.J. Blignaut (Bonus 8) MODERATOR: Dr T. Beelders TIME:

More information

State of Connecticut Workers Compensation Commission

State of Connecticut Workers Compensation Commission State of Connecticut Workers Compensation Commission Notice to Employees Workers Compensation Act Chapter 568 of the Connecticut General Statutes (the Workers Compensation Act) requires your employer,

More information

Contrast. user s guide

Contrast. user s guide N Contrast chu U77777777V user s guide c P font faq HOW TO INSTALL YOUR FONT You will receive your files as a zipped folder. For instructions on how to unzip your folder, visit LauraWorthingtonType.com/faqs/.

More information

WARM UP LESSONS BARE BASICS

WARM UP LESSONS BARE BASICS WARM UP LESSONS BARE BASICS CONTENTS Common primitive data types for variables... 2 About standard input / output... 2 More on standard output in C standard... 3 Practice Exercise... 6 About Math Expressions

More information

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case Lesson11-Inheritance-Abstract-Classes The GeometricObject case GeometricObject class public abstract class GeometricObject private string color = "White"; private DateTime datecreated = new DateTime(2017,

More information

BUCKLEY. User s Guide

BUCKLEY. User s Guide BUCKLEY User s Guide O P E N T Y P E FAQ : For information on how to access the swashes and alternates, visit LauraWorthingtonType.com/faqs All operating systems come equipped with a utility that make

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Bold U S E R S G U I D E

Bold U S E R S G U I D E Yana Regular Bold Italic USER S GUIDE S S S font faq HOW TO INSTALL YOUR FONT You will receive your files as a zipped folder. For instructions on how to unzip your folder, visit LauraWorthingtonType.com/faqs/.

More information

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls. Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:

More information

Modules. CS2023 Winter 2004

Modules. CS2023 Winter 2004 Modules CS2023 Winter 2004 Outcomes: Modules C for Java Programmers, Chapter 7, sections 7.4.1-7.4.6 Code Complete, Chapter 6 After the conclusion of this section you should be able to Understand why modules

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word. Chapter 1 Introduction to Computers, Programs, and Java

Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word. Chapter 1 Introduction to Computers, Programs, and Java Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word Chapter 1 Introduction to Computers, Programs, and Java Chapter 2 Primitive Data Types and Operations Chapter 3 Selection

More information

Appendix C. Numeric and Character Entity Reference

Appendix C. Numeric and Character Entity Reference Appendix C Numeric and Character Entity Reference 2 How to Do Everything with HTML & XHTML As you design Web pages, there may be occasions when you want to insert characters that are not available on your

More information

Computer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming

Computer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Experiment #2

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

204111: Computer and Programming

204111: Computer and Programming 204111: Computer and Programming Week 4: Control Structures t Monchai Sopitkamon, Ph.D. Overview Types of control structures Using selection structure Using repetition structure Types of control ol structures

More information

Boolean Data-Type. Boolean Data Type (false, true) i.e. 3/6/2018. The type bool is also described as being an integer: bool bflag; bflag = true;

Boolean Data-Type. Boolean Data Type (false, true) i.e. 3/6/2018. The type bool is also described as being an integer: bool bflag; bflag = true; Programming in C++ If Statements If the sun is shining Choice Statements if (the sun is shining) go to the beach; True Beach False Class go to class; End If 2 1 Boolean Data Type (false, ) i.e. bool bflag;

More information

Chapter 5 Control Statements: Part 2 Section 5.2 Essentials of Counter-Controlled Repetition

Chapter 5 Control Statements: Part 2 Section 5.2 Essentials of Counter-Controlled Repetition Chapter 5 Control Statements: Part 2 Section 5.2 Essentials of Counter-Controlled Repetition 5.2 Q1: Counter-controlled repetition requires a. A control variable and initial value. b. A control variable

More information

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book 1 Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book Year 1 Lecturer's name: MSc. Sami Hussein Ismael Academic

More information

Dept. of CSE, IIT KGP

Dept. of CSE, IIT KGP Control Flow: Looping CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of Repeated Execution Loop: Group of

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

Object Oriented Programming with Java

Object Oriented Programming with Java Object Oriented Programming with Java What is Object Oriented Programming? Object Oriented Programming consists of creating outline structures that are easily reused over and over again. There are four

More information

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. Looping. ++ is the increment operator.

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. Looping. ++ is the increment operator. Chapter 5: Looping 5.1 The Increment and Decrement Operators Copyright 2009 Pearson Education, Inc. Copyright Publishing as Pearson 2009 Addison-Wesley Pearson Education, Inc. Publishing as Pearson Addison-Wesley

More information

Communication and processing of text in the Kildin Sámi, Komi, and Nenets, and Russian languages.

Communication and processing of text in the Kildin Sámi, Komi, and Nenets, and Russian languages. TYPE: 96 Character Graphic Character Set REGISTRATION NUMBER: 200 DATE OF REGISTRATION: 1998-05-01 ESCAPE SEQUENCE G0: -- G1: ESC 02/13 06/00 G2: ESC 02/14 06/00 G3: ESC 02/15 06/00 C0: -- C1: -- NAME:

More information

Adorn. Serif. Smooth. v22622x

Adorn. Serif. Smooth. v22622x s u Adorn f Serif Smooth 9 0 t v22622x user s guide PART OF THE ADORN POMANDER SMOOTH COLLECTION v O P E N T Y P E FAQ : For information on how to access the swashes and alternates, visit LauraWorthingtonType.com/faqs

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Adorn. Slab Serif BOLD. v x. user s gu ide

Adorn. Slab Serif BOLD. v x. user s gu ide Adorn f Slab Serif BOLD t 9a0 v2226222x user s gu ide v fon t faq HOW T O I N S TA L L YOU R F ON T H O W T O I N S E R T S WA S H E S, You will receive your files as a zipped folder. For instructions

More information

font faq HOW TO INSTALL YOUR FONT HOW TO INSERT SWASHES, ALTERNATES, AND ORNAMENTS

font faq HOW TO INSTALL YOUR FONT HOW TO INSERT SWASHES, ALTERNATES, AND ORNAMENTS font faq HOW TO INSTALL YOUR FONT You will receive your files as a zipped folder. For instructions on how to unzip your folder, visit LauraWorthingtonType.com/faqs/. Your font is available in two formats:

More information

CEN 414 Java Programming

CEN 414 Java Programming CEN 414 Java Programming Instructor: H. Esin ÜNAL SPRING 2017 Slides are modified from original slides of Y. Daniel Liang WEEK 2 ELEMENTARY PROGRAMMING 2 Computing the Area of a Circle public class ComputeArea

More information

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and

More information

3. Java - Language Constructs I

3. Java - Language Constructs I Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks

More information

IST311. Advanced Issues in OOP: Inheritance and Polymorphism

IST311. Advanced Issues in OOP: Inheritance and Polymorphism IST311 Advanced Issues in OOP: Inheritance and Polymorphism IST311/602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition

More information

Spreadsheets: Mathematics

Spreadsheets: Mathematics Lesson 7 Spreadsheets: Mathematics Activity 1: Time Charts Format Data Enter a Formula Create a Series Change Column Width Activity 2: Measurements Apply Number Formats Activity 3: Calculating with a Spreadsheet

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and

More information

Loops / Repetition Statements

Loops / Repetition Statements Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for

More information

Programming, numerics and optimization

Programming, numerics and optimization Programming, numerics and optimization Lecture A-2: Programming basics II Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428 March

More information

All classes in a package can be imported by using only one import statement. If the postcondition of a method is not met, blame its implementer

All classes in a package can be imported by using only one import statement. If the postcondition of a method is not met, blame its implementer Java By Abstraction ANSWERS O ES-A GROUP - A For each question, give +0.5 if correct, -0.5 if wrong, and 0 if blank. If the overall total is negative, record it (on the test's cover sheet)

More information

Example. Write a program which sums two random integers and lets the user repeatedly enter a new answer until it is correct.

Example. Write a program which sums two random integers and lets the user repeatedly enter a new answer until it is correct. Example Write a program which sums two random integers and lets the user repeatedly enter a new answer until it is correct. 1... 2 Scanner input = new Scanner(System.in); 3 int x = (int) (Math.random()

More information

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls. Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:

More information

Check out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.

Check out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation. Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop

More information

Java Coding 3. Over & over again!

Java Coding 3. Over & over again! Java Coding 3 Over & over again! Repetition Java repetition statements while (condition) statement; do statement; while (condition); where for ( init; condition; update) statement; statement is any Java

More information

Adorn. Serif. v x. user s gu ide

Adorn. Serif. v x. user s gu ide Adorn f Serif t 9a0 v2226222x user s gu ide v fon t faq HOW T O I N S TA L L YOU R F ON T H O W T O I N S E R T S WA S H E S, You will receive your files as a zipped folder. For instructions on how to

More information

The Basic Parts of Java

The Basic Parts of Java Data Types Primitive Composite The Basic Parts of Java array (will also be covered in the lecture on Collections) Lexical Rules Expressions and operators Methods Parameter list Argument parsing An example

More information

Unit 1 Lesson 4. Introduction to Control Statements

Unit 1 Lesson 4. Introduction to Control Statements Unit 1 Lesson 4 Introduction to Control Statements Essential Question: How are control loops used to alter the execution flow of a program? Lesson 4: Introduction to Control Statements Objectives: Use

More information

Sheila. Regular Bold. User s Guide

Sheila. Regular Bold. User s Guide Sheila Regular Bold User s Guide font faq HOW TO INSTALL YOUR FONT You will receive your files as a zipped folder. For instructions on how to unzip your folder, visit LauraWorthingtonType.com/faqs/. Your

More information

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

COS 126 Midterm 1 Written Exam Fall 2011

COS 126 Midterm 1 Written Exam Fall 2011 NAME: login id: Precept: COS 126 Midterm 1 Written Exam Fall 2011 This test has 8 questions, weighted as indicated. The exam is closed book, except that you are allowed to use a one page cheatsheet. No

More information

Adorn. Slab Serif Smooth R E G U LAR. v22622x

Adorn. Slab Serif Smooth R E G U LAR. v22622x s u Adorn f Slab Serif Smooth R E G U LAR B OL D t 0 v22622x 9 user s guide PART OF THE ADORN POMANDER SMOOTH COLLECTION v O P E N T Y P E FAQ : For information on how to access the swashes and alternates,

More information

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem 1) (8 points) For the following code segment, what are the values of i, j, k, and d, after the segment

More information

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. 1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

Primitive Types and Some Simple IO in Java

Primitive Types and Some Simple IO in Java 1. Overview Primitive Types and Some Simple IO in Java The learning objectives of this laboratory session are: How to build and run a java standalone program without an IDE The elements of good programming

More information

Chapter 3 Problem Solving and the Computer

Chapter 3 Problem Solving and the Computer Chapter 3 Problem Solving and the Computer An algorithm is a step-by-step operations that the CPU must execute in order to solve a problem, or to perform that task. A program is the specification of an

More information