Final Exam Review April 18, 2018

Similar documents
Engr 123 April 25, 2018 Final Exam Review. 3. Write a method which will accept a string and return the number of three-letter words in the string.

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 25, 2016

Exam 2. CSC 121 TTH Class. Lecturer: Howard Rosenthal. April 26, 2016

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017

Introduction to Programming Using Java (98-388)

DC69 C# &.NET DEC 2015

CSC 126 FINAL EXAMINATION Spring Total Possible TOTAL 100

Name: Username: I. 20. Section: II. p p p III. p p p p Total 100. CMSC 202 Section 06 Fall 2015

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.

Object oriented lab /second year / review/lecturer: yasmin maki

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.

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 4 Certificate in IT SOFTWARE DEVELOPMENT

COM S 213 PRELIM EXAMINATION #2 April 26, 2001

CGS 3460 Summer 07 Midterm Exam

COS 126 General Computer Science Spring Written Exam 1

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

Final Exam CS 152, Computer Programming Fundamentals May 9, 2014

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)

Introduction to C# Applications

Chapter : 5 Structure data types Arrays. <<reverse[i]<< \n ; getch(); } Output:

Functions. Arash Rafiey. September 26, 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

1 Short Answer (15 Points Each)

Final Exam CS 152, Computer Programming Fundamentals December 9, 2016

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

Midterm Exam CS 251, Intermediate Programming March 6, 2015

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

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

Haskell Types COMP360

UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING

COP 3223 Introduction to Programming with C - Study Union - Spring 2018

Array. Prepared By - Rifat Shahriyar

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

Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A

Exam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80

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

CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad

CSCE 206: Structured Programming in C++

CSci 1113 Final. Name: Student ID:

Object- Oriented Analysis, Design and Programming

Pace University. Fundamental Concepts of CS121 1

Supplementary material for Bimodal Modelling of Source Code and Natural Language

Chapter 1 Getting Started

Overloading Operators in C++

Q1 Q2 Q3 Q4 Q5 Total 1 * 7 1 * 5 20 * * Final marks Marks First Question

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

CS 12 Fall 2003 Solutions for mid-term exam #2

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

AN OVERVIEW OF C++ 1

Reviewing all Topics this term

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

CSCS 261 Programming Concepts Exam 2 Fall EXAM 2 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam.

Practice problems Set 2

Exercise 1.1 Hello world

You must bring your ID to the exam.

Why Is Repetition Needed?

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING

Computer Programming C++ (wg) CCOs

1Z0-808 oracle. Number: 1Z0-808 Passing Score: 800 Time Limit: 120 min.

CSCI 136 Written Exam #0 Fundamentals of Computer Science II Spring 2015

Pre C# Fundamentals. Course reference LEARNING. Updated:

CSC 126 FINAL EXAMINATION FINAL Spring 2012 B. Name (last, First) Instructor. Total Possible. Received

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.5. for loop and do-while loop

QUEEN MARY, UNIVERSITY OF LONDON DCS128 ALGORITHMS AND DATA STRUCTURES Class Test Monday 13 th February

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

CSC 210, Exam Two Section February 1999

Learning Recursion. Recursion [ Why is it important?] ~7 easy marks in Exam Paper. Step 1. Understand Code. Step 2. Understand Execution

CSCS 261 Programming Concepts Exam 2 Fall EXAM 2 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam.

CSCE121: Introduction to Program Design and Concepts Practice Questions for Midterm 1

CS170 (005): Introduction to Computer Science Exam 2

Introduce C# as Object Oriented programming language. Explain, tokens,

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

Exceptions, Case Study-Exception handling in C++.

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II

2. Each element of an array is accessed by a number known as a(n) a. a. subscript b. size declarator c. address d. specifier

CS201- Introduction to Programming Current Quizzes

Subject: Computer Science

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

Java and C# in Depth

Variables. Data Types.

CS 367: Introduction to Data Structures Midterm Sample Questions

Student Number: Computer Science 211b Final Examination. 28 April hours

Final Exam. CSC 121 Fall 2015 TTH. Lecturer: Howard Rosenthal. Dec. 15, 2015

QUEEN MARY, UNIVERSITY OF LONDON DCS128 ALGORITHMS AND DATA STRUCTURES Class Test Monday 27 th March

LAB #8. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:

CSE143 Exam with answers MIDTERM #1, 1/26/2001 Problem numbering may differ from the test as given.

1. Find the output of following java program. class MainClass { public static void main (String arg[])

CSci 1113 Final. Name: Student ID:

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

This is CS50. Harvard University Fall Quiz 0 Answer Key

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

Agenda: Discussion Week 7. May 11, 2009

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

2/3/2018 CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II. Lecture Contents. C# basics. Methods Arrays. Dr. Amal Khalifa, Spr17

Sequential Search (Searching Supplement: 1-2)

QUEEN MARY, UNIVERSITY OF LONDON DCS128 ALGORITHMS AND DATA STRUCTURES Class Test Monday 13 th February

Transcription:

Engr 123 Name Final Exam Review April 18, 2018 Final Exam is Monday April 30, 2018 at 8:00am 1. If i, j, and k are all of type int and i = 0, j = 2, and k = -8, mark whether each of the following logical expressions is true or false. A) (i==0) (k < 7) B)!((j<5) && (k<9)) 2. If i, j, and k are all of type int and i = 4 and j = -2, what is the value of i, j, and k after execution of the following line of code? k = i++ + --j; i = j = k = 3. How many lines of print do each of the following produce? Assume all variables have been declared and are of type int. A) for(i=3;i<10;i+=2) B) i = -3; {Console.WriteLine("Jello"); while(i < 8) for(j=100;j>-1;j--) {Console.WriteLine("Hello"); {Console.WriteLine("Hello"); for(j=0;j<30;j+=2) Console.WriteLine("Mom"); i+=3; Lines of Print Lines of Print 4. The following code produces a compiler error. What is the error and show how to correct it without changing the variable declarations. int i = 1; double j = 4.23; i = j; Console.Writeline(i); 5. What is the difference between the terms ref and out with respect to passing arguments to methods in C#? 6. Give a brief example of "method overloading"? 7. Write a short sequence of code in C# which will produce 1000 random integers which have value 3, 4, 5, or 6. Your sequence should print the total number of 3's in the integer list. 1

8. The following sequence creates a 2-dimensional array of ints and fills it with data. In the space below fill in the correct values that will be in the array after the program runs. {int[,] a = {{3,2,1, {4,5,1; int r, c; for(r=0;r<2;r++) {for(c=0;c<3;c++) {if(a[r,c] == 1) a[r,c] = 0; else a[r,c] = 1 + r*c 9. The following statement creates a 2 dimensional array and initializes its values. Write a short sequence to find and print the maximum and minimum values in the array. int a[,] = {{9, 4, 3, 2], {4, 23, 32, 45, {6, 31, 14, 26; 10. The following statement creates a 1-dimensional array and initializes its values. Write a complete method named FindSum(a, out n) where a is the array and n is an int. The method finds the sum of the elements of the array and returns the sum in the parameter n. int[] a = {0, 1, 2, 3, 5, 7, 9, 0, 11; 2

11. A portion of a program is shown below which gives two methods in a windows application. The method btnstart_click runs when the user clicks on a button in the form. The method ConfuseMe runs when it is activated by btnstart_click. Complete the memory map shown for the two methods and show what is printed in the two message boxes that are used in the methods. private void btnstart_click(object sender, System.EventArgs e) {string str; int a = 1, b = 2, c; ConfuseMe(ref a, b, out c); str = a.tostring(); str += "\n" + b.tostring(); str += "\n" + c.tostring(); MessageBox.Show(str); private void ConfuseMe(ref int a, int b, out int c) {string str; a = 4; b = 7; c = 11; str = a.tostring(); str += "\n" + b.tostring(); str += "\n" + c.tostring(); MessageBox.Show(str); Printed Output: First Message Box Second Message Box ConfuseMe btnstart_click Memory 3

12. Write a function to accept a single sentence as an argument. Your function should print the sentence with the letters reversed. For example, if the sentence is: Hello Mom, bake a cake. your program should print:.ekac a ekab,mom olleh 13. Write the definition for the AProperty for the class below. using System; namespace MyClass {public class MyClass : Object {private double a; public MyClass() {AProperty = 0.0; public X(double u, double v) {AProperty = u;... 14. Write a C# program to prompt the user for an input sentence. Replace only the first occurrence of the letter sequence "as" in this sequence with the sequence "bt". Print the sequence to the console. 4

15. Suppose you have a listbox named lsbmylistbox. Show how you could add the following words to the list box: Hello My Name Is Not Mud. 16. Given a text box named txtmytextbox. Write a try/catch sequence which does input from the text box and catches all errors in the process. When any type of error occurs your program should print the word "Error" in a message box. 17. The following method does a Bubble sort on an int parameter named sortvector. Line numbers have been added to the left for reference purposes. Modify the program so that it sorts a string vector. 1 private void Sort(int[] sortvector) 2 {bool sorted = false; 3 int i, j, k, itmp; 4 while(sorted == false) 5 {sorted = true; 6 for(i=0;i<sortvector.length - 1;i++) 7 {j = sortvector[i]; 8 k = sortvector[i+1]; 9 if(j > k) 10 {itmp = sortvector[i]; 11 sortvector[i] = sortvector[i+1]; 12 sortvector[i+1] = itmp; 13 sorted = false; 14 15 16 17 5

18. In class we looked at the implementation of the game of Life using the Cell class below. A) Show how to create a two-dimensional array of type Cell with dimensions Xmax and Ymax. B) Show how to instantiate each member of the array. public class Cell {private bool alive; public Cell() {alive = false; public Cell(bool a) {alive = a; public bool Alive {get {return alive; set {alive = value; 6