TEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013

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

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

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake

Solution Set(Reference Book - Programming with c By Byron Gottfried Thrid Edition)

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

Question Bank (SPA SEM II)

Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries

CS-211 Fall 2017 Test 1 Version Practice For Test on Oct. 2, Name:

Flow Chart. The diagrammatic representation shows a solution to a given problem.

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

CMPE Experiment 3 Selective Structures

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

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

Unit 3 Decision making, Looping and Arrays

Language comparison. C has pointers. Java has references. C++ has pointers and references

Tutorial No. 2 - Solution (Overview of C)

C introduction: part 1

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

COMP 208 Computers in Engineering

M1-R4: Programing and Problem Solving using C (JAN 2019)

Subject: Fundamental of Computer Programming 2068

Introduction to Programming

Introduction to C Language (M3-R )

LAB 6 FUNCTIONS I School of Computer and Communication Engineering

Principles of Programming. Chapter 6: Arrays

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

80 Minutes CENG 230 MidtermExam :40

Programming for Engineers Iteration

Basic and Practice in Programming Lab7

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

CSE 142 Wi01 Midterm 2 page 1 of 6

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.

SECTION A TRUE / FALSE QUESTIONS (10 MARKS) (INSTRUCTION: Please answer all 10 questions)

DEPARTMENT OF COMPUTER ENGINEERING CMPE101: Foundation of Computer Engineering EXPERIMENT 3. Introduction to C Programming: Sequential code structure

Sample Examination. Family Name:... Other Names:... Signature:... Student Number:...

b. array s first element address c. base address of an array d. all elements of an array e. both b and c 9. An array elements are always stored in a.

Flow Control. CSC215 Lecture

Sample Paper - II Subject Computer Science

Data Types and Variables in C language

Arrays and Applications

C Programming Lecture V

UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING

Pointers and scanf() Steven R. Bagley

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

Arrays in C. By Mrs. Manisha Kuveskar.

Midterm Examination # 2 Wednesday, March 18, Duration of examination: 75 minutes STUDENT NAME: STUDENT ID NUMBER:

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

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring

C programming basics T3-1 -

2. Which of the following will print the value 2 for the above code?

Array. Arrays. Declaring Arrays. Using Arrays

More examples for Control statements

2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.

Example: Pointer Basics

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam

CSE202-Lec#4. CSE202 C++ Programming

Operators and Expressions:

Prepared by: Shraddha Modi

C-Programming. CSC209: Software Tools and Systems Programming. Paul Vrbik. University of Toronto Mississauga

Week 2 / Lecture 2 15 March 2017 NWEN 241 Control constructs, Functions. Alvin Valera

1. General Computer Questions

Operators And Expressions

Problem Solving. Problem Solving Concept for Computer Science

Government Polytechnic Muzaffarpur.

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

This is CS50. Harvard University Fall Quiz 0 Answer Key

Computer Programming for Engineering Applica4ons. Intro to Programming 10/2/13 ECE 175. Limita4ons of Reference by Value. The Concept of Pointers

Lecture 02 C FUNDAMENTALS

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017

The Hyderabad Public School, Begumpet, Hyderabad, A.P

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

Structures. Basics of Structures (6.1) EECS l Now struct point is a valid type. l Defining struct variables: struct point { int x; int y; };

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

Midterm Review. Short Answer. Short Answer. Practice material from the Winter 2014 midterm. Will cover some (but not all) of the questions.

C Functions. CS 2060 Week 4. Prof. Jonathan Ventura

COMPUTER SCIENCE (083)

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION

Introduction to C Language

Essar Placement Paper

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

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

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I

THE FUNDAMENTAL DATA TYPES

Mechatronics and Microcontrollers. Szilárd Aradi PhD Refresh of C

1.1 Basic Concepts 1

3. Types of Algorithmic and Program Instructions

Arrays. Example: Run the below program, it will crash in Windows (TurboC Compiler)

n Group of statements that are executed repeatedly while some condition remains true

Final Intro to C Review

Fundamental of Programming (C)

Flow of Control. Selection. if statement. True and False in C False is represented by any zero value. switch

Computers Programming Course 7. Iulian Năstac

Assoc. Prof. Dr. Tansu FİLİK

ESC101N: Fundamentals of Computing End-sem st semester

Lab 3. Pointers Programming Lab (Using C) XU Silei

EXERCISES (Software Engineering)

3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition)

Midterm Exam. CSCI 2132: Software Development. March 4, Marks. Question 1 (10) Question 2 (10) Question 3 (10) Question 4 (10) Question 5 (5)

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Transcription:

DEPARTMENT OF MATERIAL AND ENGINEERING DESIGN FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING UNIVERSITI TUN HUSSEIN ONN MALAYSIA (UTHM), JOHOR TEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013 Student Name Matrix Number Section :. :. :. THIS TEST PAPER HAS 9 PRINTED PAGES

1. What is the output of following for loop source code? a. This is a for loop -5-4 -3-2 -1 0 b. This is a for loop -5-4 -3-2 -1 0 1 c. This is a for loop -6-5 -4-3 -2-1 0 d. This is a for loop -6-5 -4-3 -2-1 #include<conio.h> int main(void){ int k; printf("this is a for loop\n"); for(k = -6; k <= 0; k = k +1) {printf("%d ", k);} getch(); return 0; } 2. What is the output of the following code? a. :Yes Sir! Rightaway Sir!: : Yes Sir! R: b. :Yes Sir! R: : Yes Sir! R: c. :Yes Sir! R: :Yes Sir! R : d. :Yes Sir! Rightaway Sir!: :Yes Sir! R : main(){ printf(":%-10s:\n", "Yes Sir! Rightaway Sir!"); printf(":%15.10s:\n", " Yes Sir! Rightaway Sir!"); getch(); } 3. What is the output of the following code? a. 5.1 005 b. 0.0 0005 c. 5.1 0005 d. 0.0 005 main(){ float a,b; int c,d; a = 15.3; b = a/3; printf("%.1f\n",b); c = 20; d = c/4; printf("%03d\n",d); getch(); }

4. Which of the definition is correct? a. char int; b. int long; c. int width; d. float double; 5. What will be the output for the program? a. 6 b. 6.0 c. 6.000000 d. Error: prototype sqrt() not found #include<math.h> int main() { printf("%f\n", sqrt(36.0)); return 0; } 6. How many times will Chukoku be printed? a. 0 times b 5 times c. 10 times d Infinite times int main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break; printf("chukoku"); } return 0; } 7. What is the value of x after the following statement? float x; x = 3.0 / 4.0 + 3 + 2 / 5; a. 4.15 b. 5.75 c. 1.75 d. 3.75

8. What is the correct way to write the condition c < r < z? a. (c< r< z) b. ( (c< r) && z) c. ((c> r) (c < z)) d. ((c < r) && (r< z)) 9. If x is 0, what is the value of (!x ==0)? a. false b. true c. unable to determine d. 1 10. Which of the following cannot be checked in a switch-case statement? a. character b. float c. integer d. All of the above 11. Which of the following are valid case statements in a switch? a. case 1: b. case x<4: c. case abc : d. case 1.5: 12. int r[3][4]; will have how many element in the array? a. 7 b. 12 c. 9 d. 16 13. Which of the following is correct for = and ==? e. = use in conditional operation while == use in mathematical operation. f. = and == used in program representing equal. g. == use only in conditional operation while = in mathematical operation. h. = and == is a type of function.

14. int array[a][b]; what is a and b represent? a. [Colums][rows] ; b. [data] [Colums]; c. [rows] [Colums]; d. [Colums][size]; 15. for(int item=0;item<=35;item+=5) How many times the coding will execute the statement inside { } a. 7 b. 8 c. 9 d. 6 16. Which of the following statement fits the following equation a. temp= (4* pow(t,2)/(t+2))-20; b. temp= 4* pow(t,2)/((t+2)-20); c. temp= 4*t*t/((t+2)-20); d. temp= (4*t*t)/t+2-20; 17. Choose the correct output for a. 2 3 b. 1 2 c. 1 3 d. 2 4 int a = 1; printf("%d\t",a++); printf("%d\n",++a); 18. Which is incorrect statement related to #define a. #define is use for macros b. #define use to define constant value c. #define can only use for PI (e.g: #define PI 3.142) d. #define is a global declaration for constant value

19. Which are valid identifier/variable: a. BTI 10202 b. school c. void d. 123abc 20. Which of the following is NOT one of the standard C data type? a. double b. byte c. int d. char 21. What is the output for the following code? int a = 1; int b = 2; int c = 3; a=c; c=b; b=a; printf( %d %d %d, a,b,c); a. 3 2 1 b. 1 3 3 c. 3 3 2 d. 2 3 1 22. What is the output for the following code? float x = 1 / 2; printf( %f, x); a. 0.000000 b. 0.500000 c. 1.000000 d. 0

23. Consider the following two lines of output. abc def Which of the following code will produce exactly this output? a. printf( abc\ndef ); b. printf( abc ); printf( def ); c. printf( abc\n ); printf( \n ); printf( def\n ); d. printf( abc ); printf( ); printf( def ); 24. Consider the following conditional statement if (!( (a < b) (b == c) ) ) { printf( success ); } What values for a,b and c would result in success being printed out to the screen? a. int a = 20; int b = 20; int c = 20; b. int a = 10; int b = 20; int c = 30; c. int a = 30; int b = 20; int c = 20; d. int a = 20; int b = 20; int c = 30;

25. Which of the following C expression does not evaluate to 7? a. 1 + 2 * 3 b. 17 % 10 c. (int) 6.6 + (int) 0.5 d. 15 / 2 26. What output is produced by the following code? float a = 1.9; float b = 1.8; int c = (int) (a + b); printf( %d, c); a. 1 b. 2 c. 3 d. 4 27. What output is produced by the following code? int a = 10; float b = 16; float c = b / a; printf( %f, c); a. 1 b. 1.000000 c. 1.600000 d. %f 28. What output is produced by the following code? int a = 5 % 9; int b = 9 % 3; printf( %d %d, a, b); a. 4 6 b. 4 0 c. 5 6 d. 5 0

29. Which line of code should replace????? below to correctly calculate the average of x and y and PRODUCE 3.500000 as output? float average; int x = 3; int y = 4;????? printf( %f, average); a. average = (x+y) / 2; b. average = x / 2 + y / 2; c. average = (x + y) / 2.0; d. average = x + y / 2.0; 30. Consider the following while loop int i = 0; while ( i < 3) { printf( %d \n, i); i++; } Which for loop below produces DIFFERENT output to the while loop above? a. int i; for (i = 0; i < 3; i++) { printf( %d\n, i); } b. int i; for (i = 3; i >= 0; i--) { printf( %d\n, (3 - i)); } c. int i; for (i = 0; i <= 2; i++) { printf( %d\n, i ); } d. int i; for (i = 1; i < 4; i++) { printf( %d\n, (i 1)); }