M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

Similar documents
M1-R4: Programing and Problem Solving using C (JULY 2018)

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

A3-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH 'C' LANGUAGE

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

Introduction to C Language (M3-R )

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

Questions Bank. 14) State any four advantages of using flow-chart

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

Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

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


PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur

Code No: R Set No. 1

IV Unit Second Part STRUCTURES

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

Subject: Fundamental of Computer Programming 2068

C-LANGUAGE CURRICULAM

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING

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.

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

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

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

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

M4.1-R4: APPLICATION OF.NET TECHNOLOGY

Fundamental of Programming (C)

Tribhuvan University Institute of Science and Technology 2065

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:

ESC101N: Fundamentals of Computing End-sem st semester

Technical Questions. Q 1) What are the key features in C programming language?

(i) Describe in detail about the classification of computers with their features and limitations(10)

COMPUTER APPLICATION

At this time we have all the pieces necessary to allocate memory for an array dynamically. Following our example, we allocate N integers as follows:

Computer Science & Information Technology (CS) Rank under AIR 100. Examination Oriented Theory, Practice Set Key concepts, Analysis & Summary

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

Linked-List Basic Examples. A linked-list is Linear collection of self-referential class objects, called nodes Connected by pointer links

CS201- Introduction to Programming Current Quizzes

Fundamentals of Programming

'C' Programming Language

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

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

Computer Science & Engineering 150A Problem Solving Using Computers

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

Course Title: C Programming Full Marks: Course no: CSC110 Pass Marks: Nature of course: Theory + Lab Credit hours: 3

DEPARTMENT OF MATHS, MJ COLLEGE

Dept. of CSE, IIT KGP

UNIT-V. Structures. The general syntax of structure is given below: Struct <tagname> { datatype membername1; datatype membername2; };

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

Main Program. C Programming Notes. #include <stdio.h> main() { printf( Hello ); } Comments: /* comment */ //comment. Dr. Karne Towson University

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

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

AMCAT Automata Coding Sample Questions And Answers

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];

Question Bank (SPA SEM II)

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and

C: How to Program. Week /Mar/05

Reg. No. : Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, JANUARY First Semester GE 6151 COMPUTER PROGRAMMING

Example: Structure, Union. Syntax. of Structure: struct book { char title[100]; char author[50] ]; float price; }; void main( )

C programming basics T3-1 -

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

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

Q 1. Attempt any TEN of the following:

A Fast Review of C Essentials Part I

Write a C program using arrays and structure

Introduction to C. Systems Programming Concepts

Lecture 02 Summary. C/Java Syntax 1/14/2009. Keywords Variable Declarations Data Types Operators Statements. Functions

C/Java Syntax. January 13, Slides by Mark Hancock (adapted from notes by Craig Schock)

C/Java Syntax. Lecture 02 Summary. Keywords Variable Declarations Data Types Operators Statements. Functions. if, switch, while, do-while, for

Chapter 2 - Introduction to C Programming

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

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

Advanced C Programming and Introduction to Data Structures

CSCI 171 Chapter Outlines

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR. VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS

Control Structures. Chapter 13 Control Structures. Example If Statements. ! Conditional. if (condition) action;

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

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

Multiple Choice Questions ( 1 mark)

Darshan Institute of Engineering & Technology for Diploma Studies Unit 5

Lecture 02 C FUNDAMENTALS

BLM2031 Structured Programming. Zeyneb KURT

Name :. Roll No. :... Invigilator s Signature :.. CS/B.TECH (NEW)/SEM-2/CS-201/ BASIC COMPUTATION & PRINCIPLES OF COMPUTER PROGRAMMING

Storage class and Scope:

Bil 104 Intiroduction To Scientific And Engineering Computing. Lecture 7

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

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

Review of the C Programming Language for Principles of Operating Systems

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA

Computers Programming Course 7. Iulian Năstac

C Introduction. Comparison w/ Java, Memory Model, and Pointers

A First Book of ANSI C Fourth Edition. Chapter 12 Structures

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

Chapter 2 (Dynamic variable (i.e. pointer), Static variable)

CSE 5A Final Fall 2006

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

Object Oriented Pragramming (22316)

Computers Programming Course 10. Iulian Năstac

Kurt Schmidt. October 30, 2018

Transcription:

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the OMR ANSWER SHEET only, supplied with the question paper, as per the instructions contained therein. PART ONE is NOT to be answered in the answer book. 3. Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO will be supplied at the table when the answer sheet for PART ONE is returned. However, candidates, who complete PART ONE earlier than one hour, can collect the answer book for PART TWO immediately after handing over the answer sheet for PART ONE. TOTAL TIME: 3 HOURS TOTAL MARKS: 100 (PART ONE 40; PART TWO 60) PART ONE (Answer all the questions) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the OMR answer sheet supplied with the question paper, following instructions therein. 1.1 Which of the following function declaration need not have a return statement in its body? A) int a(char *s) B) void b(int a[], int n) C) float *c() D) short d(long x) 1.2 Identify the correct sequence of steps to run a program A) link, load, code, compile and execute B) code, compile, link, execute and load C) code, compile, link, load and execute D) compile, code, link, load and execute 1.3 What will be the output of the following code segment? char *p = "Structured Programming"; printf("%s", p + 5); A) Structured Programming B) tured Programming C) ctured Programming D) There will be no output as there is a syntax error in code 1.4 Which of the following is an incorrect syntax? A) void outerfn() { int innerfn(float f) { B) struct outer { struct inner { I; ; M3-R4 Page 1 of 5 July, 2014

C) if (i < 10) { if (x == y) { D) for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { 1.5 For the following definitions char a[] = "Hello World!"; int i; Which of the following loop will print the output as Hello World! A) for (i = 0; a[i]!= '/0'; i++) printf("%s", a[i]); B) for (i = 0; a[i]!= '/0'; i++) printf("%c", a[i]); C) for (i = 0; a[i]!= '\0'; i++) printf("%s", a[i]); D) for (i = 0; a[i]!= '\0'; i++) printf("%c", a[i]); 1.6 Consider the statement given below: int a[5] = {1, 2, 3, 4, 5, *p = a; Which printf statement will print the value of fourth element of the array? A) printf("%d ", *(p + 3)); B) printf("%d", p[4]); C) printf("%d ", a + 3); D) printf("%d ", *a + 3); 1.7 What will be the output of the following code segment? int x = 24, y = 39, z = 45; z = x + y; y = z - y; x = z - y; printf("\n%d %d %d", x, y, z); A) 24 39 63 B) 39 24 63 C) 24 39 45 D) 39 24 45 1.8 Which of the following is the correct way to define a two dimensional array? A) int a[ ][4]; B) int b[2, 4]; C) int c[2][ ]; D) int d[ ] [ 4] = {{1, 3, 5, 7, {2, 4, 6, 8; M3-R4 Page 2 of 5 July, 2014

1.9 What will be the output of the following code segment if Hello there is given as input? char a[20]; scanf("%s", a); printf("%s", a); A) Hello there B) Hello C) "Hello there" D) "Hello" 1.10 What will be the output of the following code segment? void fn() { static int i = 10; printf("%d ", ++i); main() { fn(); fn(); A) 10 10 B) 11 11 C) 11 12 D) 12 12 2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the OMR answer sheet supplied with the question paper, following instructions therein. 2.1 A printf statement can be used to display output on different lines. 2.2 # is used to insert comments in the program. 2.3 The statement fopen("data.txt", "w+") will open a file named data.txt for both reading and writing. 2.4 Structures can have bit fields. 2.5 If no storage class is mentioned for a variable defined in a function then it is by default auto. 2.6 It is necessary to have default case in a switch statement. 2.7 A continue statement must be enclosed in a loop. 2.8 The names of parameters in a function definition and its declaration must be same. 2.9 sizeof() is a function used to determine the amount of memory occupied by a variable. 2.10 The address of the variable is passed to a function in call by reference. M3-R4 Page 3 of 5 July, 2014

3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the OMR answer sheet supplied with the question paper, following instructions therein. X 3.1 Terminates program A. union 3.2 Calls itself B. Typecasting 3.3 Dynamic memory allocation C. strcmp() 3.4 Space for one member only D. "%[^\n]" 3.5 Explicit conversion E. fseek() 3.6 p -> member_name F. exit() 3.7 File pointer movement G. Recursive functions 3.8 String comparison H. Array 3.9 Unary operator I. ++ 3.10 Reading line with scanf() J. malloc() Y K. (*p).member_name L. Structure M. fabs() 4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the OMR answer sheet supplied with the question paper, following instructions therein. A. goto B. break C. ++ D. structure E. do while F. Linked lists G. infinite H. %.10s I. continue J. int K. Array L. fprintf M. pointer 4.1 is used to club variables of different data types as a unit. 4.2 It is necessary to have a pointer to the next node in. 4.3 loop is executed atleast once. 4.4 If there is no test condition in a for loop then it becomes a(n) loop. 4.5 Avoid the use of statement in the program. 4.6 An operator which can change the value of a variable on the right hand side of an expression is. 4.7 If a function is defined as fn(char a){, then its return type is. 4.8 Format code in printf to print exactly 10 characters is. 4.9 A variable stores the address of another variable. 4.10 can be used to write in a file. M3-R4 Page 4 of 5 July, 2014

PART TWO (Answer any FOUR questions) 5. a) Write a function which accepts an array of size n containing integer values and returns average of all values. Call the function from main program. b) Draw a flowchart to print the factorials of numbers from 1 to n where n is entered by user. c) Write a function to display the multiplication table of the number. (5+5+5) 6. a) Write a program to determine the sum of the following series: S = 1 3 + 5 7 + n Read the value of n from the user. b) The * symbol is used for two different purposes in pointer data type. Explain them. c) Write a function that returns 1 if the two matrices passed to it as argument are equal and 0 otherwise. (5+5+5) 7. a) Write a program to copy a file into another file. b) Given the linked list: first 6 2 3 9 1 Show how the linked list will appear after every operation (as mentioned below) is carried out. Assume that the operations are carried out one after another. addathead(5); addathead(4); addafter(3, 7); // 7 is to be added after 3 delete(5); (7+8) 8. a) Write a program which asks the user to enter the name and age of persons in his group. The numbers of persons is not known to the user in the beginning of the program. The user keeps on entering the data till the user enters the age as zero. The program finally prints the average age. b) Write a program to display all the prime numbers between two positive integers m and n. The values of m and n are to be taken from the user. (8+7) 9. a) Using a switch statement, write a function to count the number of vowels and number of blanks in a character array passed to it as an argument. b) Define a structure of student with the following fields: rollno, name and marks. Write a program to read and store the data of at most 30 students in an array. Also display the average marks of the students. (6+9) M3-R4 Page 5 of 5 July, 2014