Quiz1 Fall 2007 October 2 nd, UNIVERSITY OF WINDSOR Fall 2007 QUIZ # 1 Solution. Examiner:Ritu Chaturvedi Dated :October 2nd, 2007.

Similar documents
UNIVERSITY OF WINDSOR Fall 2006 QUIZ # 1. Examiner:Ritu Chaturvedi Dated : Oct 3rd, Student Name: Student Number:

UNIVERSITY OF WINDSOR Winter 2007 QUIZ # 1 Solution. Examiner:Ritu Chaturvedi Dated : Feb 7 th, Student Name: Student Number:

UNIVERSITY OF WINDSOR Fall 2007 QUIZ # 2 Solution. Examiner : Ritu Chaturvedi Dated :November 27th, Student Name: Student Number:

AMCAT Automata Coding Sample Questions And Answers

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Chapter 3 Structured Program Development

Full file at C How to Program, 6/e Multiple Choice Test Bank

C: How to Program. Week /Mar/05

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

CSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU

Chapter 2 - Introduction to C Programming

CSE 5A Final Fall 2006

CSI33 Data Structures

Introduction to C Final Review Chapters 1-6 & 13

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

Chapter 1 & 2 Introduction to C Language

AN OVERVIEW OF C. CSE 130: Introduction to Programming in C Stony Brook University

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

Fundamentals of Programming Session 4

Approximately a Final Exam CPSC 206

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Chapter 1 INTRODUCTION

Introduction to Computer Science Midterm 3 Fall, Points

CpSc 111 Lab 3 Integer Variables, Mathematical Operations, & Redirection

15 FUNCTIONS IN C 15.1 INTRODUCTION

Computer System and programming in C

These are reserved words of the C language. For example int, float, if, else, for, while etc.

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

CS Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015

Unit 7. Functions. Need of User Defined Functions

Decision Making -Branching. Class Incharge: S. Sasirekha

Structured Program Development in C

بسم اهلل الرمحن الرحيم

This exam is to be taken by yourself with closed books, closed notes, no calculators.

Intro to Computer Programming (ICP) Rab Nawaz Jadoon

CpSc 1011 Lab 3 Integer Variables, Mathematical Operations, & Redirection

UIC. C Programming Primer. Bharathidasan University

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

Question 2. [5 points] Given the following symbolic constant definition

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Lab Exam 1 D [1 mark] Give an example of a sample input which would make the function

ET156 Introduction to C Programming

School of Computer Science Introduction to Algorithms and Programming Winter Midterm Examination # 1 Wednesday, February 11, 2015

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

Overview of C, Part 2. CSE 130: Introduction to Programming in C Stony Brook University

Lecture 2: C Programming Basic

CSc Introduction to Computing

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

Week 1 Introduction to Computer and Algorithm (Part1) UniMAP Sem II 11/12 DKT121: Basic Computer Programming 1

Lecture 3. More About C

CSE123 LECTURE 3-1. Program Design and Control Structures Repetitions (Loops) 1-1

Note: unless otherwise stated, the questions are with reference to the C Programming Language. You may use extra sheets if need be.

Introduction to C Language

Structured Program Development

DECISION MAKING STATEMENTS

AN OVERVIEW OF C, PART 3. CSE 130: Introduction to Programming in C Stony Brook University

2. Numbers In, Numbers Out

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

Chapter 2, Part I Introduction to C Programming

Control Structure: Loop

Why VC++ instead of Dev C++?

Functions. Arash Rafiey. September 26, 2017

SHARDA UNIVERSITY SCHOOL OF ENGINEERING & TECHNOLOGY Mid Term Examination, (Odd Term, ) SOLUTION

SEQUENTIAL STRUCTURE. Erkut ERDEM Hacettepe University October 2010

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

Introduction to C Programming

Chapter 2: Overview of C. Problem Solving & Program Design in C

C Language, Token, Keywords, Constant, variable

Introduction to the C Programming Language

Arrays. C Types. Derived. Function Array Pointer Structure Union Enumerated. EE 1910 Winter 2017/18

ECE264 Fall 2013 Exam 1, September 24, 2013

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

Data Types and Variables in C language

Course Outline. Introduction to java

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

Copy: IF THE PROGRAM or OUTPUT is Copied, then both will have grade zero.

Introduction to C Language (M3-R )

Programming for Engineers Introduction to C

Precedence and Associativity Table. % specifiers in ANSI C: String Control Codes:

Compiling and Running a C Program in Unix

Lecture 2. Examples of Software. Programming and Data Structure. Programming Languages. Operating Systems. Sudeshna Sarkar

C Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

Make sure the version number is marked on your scantron sheet. This is Version 1

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

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Computer Programming. Decision Making (2) Loops

EC 413 Computer Organization

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.

.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar..

Fundamentals of Programming Session 8

UNIT III (PART-II) & UNIT IV(PART-I)

CS Introduction to Programming Midterm Exam #1 - Prof. Reed Spring 03

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng

Preview from Notesale.co.uk Page 6 of 52

2. Numbers In, Numbers Out

ME 172. Lecture 2. Data Types and Modifier 3/7/2011. variables scanf() printf() Basic data types are. Modifiers. char int float double

Arrays in C. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur. Basic Concept

Transcription:

UNIVERSITY OF WINDSOR 60-106-01 Fall 2007 QUIZ # 1 Solution Examiner:Ritu Chaturvedi Dated :October 2nd, 2007. Student Name: Student Number: INSTRUCTIONS (Please Read Carefully) No calculators allowed. Examination Period is : 1 hour Answer all questions in the bubble sheet provided to you. You must use a pencil to mark the answer. There are 10 True/False questionsand 25 multiple choice questions. Select only one answer for each question. Write your name and student number on the examination paper as well as the bubble sheet and submit both the bubble sheet and the examination paper before you leave the exam hall. Total Marks : 70 Total number of pages : 11 There may be more than one possible answer. Choose the best possible answer. Good Luck!!! 1

SECTION I (TRUE OR FALSE ) : 10 X 2 = 20 marks. You may use choice of a for TRUE and choice of b for False: 1. All information that is to be processed by a computer must first be entered into memory via an input device. TRUE 2. A list of instructions provided to the computer is called a program. TRUE 3. Statements in a high-level language are converted to statements in machine language by a loader. FALSE 4. After the last statement of a function executes, control is transferred to the next defined function. FALSE 5. A syntax error in a program is an error that causes the program to produce incorrect output. FALSE 6. This assignment statement stores the sum of b and c in a: b + c = a; FALSE 7. A type char literal is enclosed in single quotes. TRUE 8. If the computer is switched off, data in secondary storage is usually not lost. TRUE 9. Functions are permitted to have only one input argument. FALSE 10. Because the following statement is a valid call to function wow, wow must be a void function. FALSE num = wow(x, y); 2

SECTION II : (Multiple Choice ) : 25 X 2 = 50 marks 1. The object file(a.out) is created by the. a. editor b. loader c. central processing unit d. compiler 2. A is a set of values and a set of operations on those values. a. file b. data type c. precedence rule d. library 3. Which of the types listed below can be the type of the result value returned by a userdefined function? a. int b. double c. char d. all of the above 4. Which of the following is not an advantage of a high-level language? a. It is easier to use than machine language. b. Its statements resemble English. c. It is easy for the machine to understand. d. All of the above 5. If num is a variable of type int and temp is a variable of type float, how could you correctly complete the scanf statement given below? scanf("%f%d", ); a. num, temp b. &num, &temp c. temp, num d. &temp, &num 3

6. A diagram of the hierarchical organization of the subproblems of a solution is called. a. stepwise refinement b. a structure chart c. a top-down approach d. function calls 7. Which one of the following expressions does not evaluate to 3? a. 2 + 16 % 5 b. 7-15 / 4 c. 6 * 5 / 10 d. 2-4 * 3 + 26 / 2 e. 8-5 8. Text enclosed in /* */ in a C program. a. gives instructions to the processor b. declares memory requirements c. is ignored by the C compiler d. causes a syntax error 9. A C compiler detects. a. syntax errors b. run-time errors c. result errors d. arithmetic faults 10. What value is assigned to q in the statement q = fun(2, 5, 4); if fun is defined as follows? int fun(int q, int b, int c) { int p; p = q * b + 2 * c; } return (p); 4

a. 11 b. 17 c. 18 d. 40 11. The formal parameters of the function fun are : a. q, fun b. p, b, c c. q, b, c d. p, q, b, c 12. What value gets stored in c after the following instructions are executed? int a,b,c; a = 5; b = 3; c = b * a / b % 2-1; a. 7 b. 7.5 c. -1 d. 0 13. The simple program segment for getting the sum of two numbers is. a. scanf( %d %d,num1, Num2); sum = Num1 + Num2; printf( %d,sum); b. scanf( %d%d,&num1,&num2); sum = Num1 + Num2; printf( %d,sum); c. scanf( %d %d,&num1, &Num2); average = (Num1 + Num2)/2; printf( %d,average); d. Read Num1, Num2; Sum = Num1 + Num2; Print Sum; 5

14. The correct statement which prints out the text Welcome, followed by a newline is : a. printf( Welcome\n ); b. printf(welcome, \n ); c. printf( Welcome\n ); d. printf(welcome\n); 15. The UNIX command on arc1.uwindsor.ca to compile a C program called a.c is: a. CC a.c b. cc a.c c. pico a.c d. a.out 16. Which of the following variable declarations are invalid? a. float num; b. int q; c. double plywood ; // there was a typo in the exam (missing ;) - d. all of the above // so, Question 16 will not be graded e. none of a,b,c 17. A location in the computer s memory that may contain different values at various times throughout the execution of a program is called a. a. constant b. variable c. keyword d. entity 6

Use the program given below to answer questions 18 and 19. #include <stdio.h> void module1(int, int); void main(void){ int a, b; a=5; b=16; module1(a,b); printf( %d %d \n,a, b); } //end of main void module1 (int a, int b){ a = a / 2; b = b % 2; } //end of function module1 18. What values of a gets printed when the above program is run? a. 0 b. 5 c. 16 d. 7 19. What values of b gets printed when the above program is run? a. 0 b. 5 c. 16 d. 7 20. Which of the following statements is a valid call to function abc? a. call abc; b. abc; c. p = abc(q); d. void abc(void); 7

21. Write a C assignment instruction for the following mathematical formula: a + b c + d a. a + b / c + d b. (a + b / c + d) c. (a + b) / (c + d) d. a / c + b / d Use the program below to anser questions 22 and 23. Line numbers are given for convenience: Line 1 #include <stdio.h> Line 2 void main(void){ Line 3 int a; Line 4 int b Line 5 scanf( %d, &a); Line 6 b = a + a; Line 7 printf( New b = %d \n, b); Line 8 } //end of main 22. Which line in the program above has an error? a. Line 3 b. Line 4 c. Line 5 d. Line 6 23. In which category does the above error fall into? a. Syntax error b. Run-Time error c. Logical error d. Undetected error 8

Use the program given below to answer questions 24 and 25 : #include <stdio.h> void main(void){ int m, n; m = 5; n = 7; m = m + 5; n = 3 * n; printf( %d \n, m); printf( %d \n, n); //1 st print statement //2 nd print statement } 24. What gets printed by the 1 st printf statement in the program above : a. 10 b. 35 c. 21 d. 12 25. What gets printed by the 2 nd printf statement in the program above : a. 10 b. 35 c. 21 d. 12 9