Size: px
Start display at page:

Download ""

Transcription

1 Test Paper 1 Programming Language 1(a) What is a variable and value of a variable? A variable is an identifier and declared in a program which hold a value defined by its type e.g. integer, character etc. Here a variable is declared named x which holds integer type value as well as value 3 is assigned. int x; x=3; (b) Describe four basic data types. Write the purpose of the qualifiers const and volatile. The four basic data types are: (i) Integer (ii) Real (iii) Character and (iv) String. These are defined using the keyword int, float and char respectively. const: Makes variable value or pointer parameter unmodifiable. When const is used with a variable, it uses the following syntax: const variable-name [ = value]; In this case, the const modifier allows you to assign an initial value to a variable that cannot later be changed by the program. For example, const my_age = 32; Any assignments to 'my_age' will result in a compiler error. However, such declaration is quite different than using #define my_age 32 In the first case, the compiler allocates a memory for 'my_age' and stores the initial value 32 there, but it will not allow any later assignment to this variable. But, in the second case, all occurences of 'my_age' are simply replaced with 32 by the preprocessor, and no memory will be allocated for it. Warning: a const variable can be indirectly modified by a pointer, as in the following example: *(int*)&my_age = 35; When the const modifier is used with a pointer parameter in a function's parameter list, it uses the following syntax: function-name (const type *var-name)

2 Then, the function cannot modify the variable that the pointer points to. For example, int printf (const char *format,...); Here the printf function is prevented from modifying the format string. Volatile: If we declare a variable as volatile, every time the fresh value is updated. The volatile keyword can be used to state that a variable may be changed by hardware, the kernel, another thread etc. The volatile keyword may prevent unsafe compiler optimisations for memory-mapped input/output. (c) Which of the following are invalid variable names and why; (i) doubles; (ii) Minimum; (iii) row total; (iv) 3rd-row; (v) name. (iii) row and total is separated by white space which makes it invalid variable name. The correct name is row_total. (iv) 3rd-row is wrong variable name. Because digit should not be the first character and hyphen is now allowed in any identifier. The correct name is third_row. (d) Write a program in C to calculate the area and circumference of a circle. #include <conio.h> #define PI void main() float radius, circumference, area; clrscr(); printf( Enter value of Radius ); scanf( %f,&radius); area=pi*radius*radius; circumference=2*pi*radius; printf( \nthe circle area = %f and circumference = %f, area, circumference);

3 2(a) What are the different types of operators used in C program? With example and explain about logical operators and bitwise operators. The operator used in C programming language are : (i) Arithmetic operator/unary Operator & Assignment Operator (ii) Relational Operator (iii) Logical Operator (iv) Bitwise operator Arithmetic/Unary operator: +, _ Assignment Operator: = Relational Operator: <, >, <=, >= Logical Operator: &&,, == Bitwise Operator: Example: x=3; x=x+1; Here 3 is assigned in x in the first expression and x s value in incremented using arithmetic/unary operator (+) and again assigned in x in the next statement. x=8; y=5; if((x*y)>30) printf( %d,(x*y)); Here the multiplication result of (x*y) is compared with 30 using relational operator greater than (>) and if it is greater than 30 then it is shown on the display screen. char ch1,ch2; if((ch1== a ) (ch2== A ))printf( Same alphabet ); In this above example, either ch1 or ch2 holds small a or capital A, then a text message is displayed. is logical OR used in this example. (b) Why we need to use #include <math.h> and #include <ctype.h> statement in C program? math.h is header file which is included in a C program when some mathematical functions are used in the program e.g. sqrt(x); returns value of square root of x. This particular function is only found in math.h header file. ctype.h is another header file which is included in a C program when character related functions are used in that program e.g. tolower(); or tupper(); which functions returns a character into upper case and lower case respectively. These functions are used for character case conversion.

4 (c) In what ways does a switch statement differ from an if statement? An example of if statement is if(x==5)printf( Five ); This above example is simple but it can be nested as follows: if (x==0) printf( Zero ); else if (x==1) printf( One ); else if (x==2) printf( Two ); else if (x=3) printf( Three ); else printf( More than 3 ); This above statement can also be written using switch statement as follows: switch(x) case 0: printf( Zero ); break; case 1: printf( One ); break; case 2: printf( Two ); break; case 3: printf( Three ); break; default: printf( More than 3 ); break; Therefore, a switch statement is differed from nested if else statement in above manner. (d) Write down the general form and flowchart of IF, IF-ELSE and nested IF-ELSE statement. The general form of IF statement: if (condition)expression IF-ELSE statement: if (condition)expression 1 elseexpression 2 nested IF-ELSE statement: if (condition)expression 1 else if (condition)expression 2 else if (condition)expression 3 else expression 4

5 Flowcharts: cond cond expr expr2 expr1 IF statement IF-ELSE statement cond cond expr1 cond expr2 expr3 expr4 Nested IF-ELSE statement (e) Write a C program to find the number of and sum of all integers greater than 50 and less than 300 that are divisible by 9? #include <conio.h> void main() int generate_number(int x);//function prototype int summation(int x[],int n);//function prototype int i,index,sum,temp; int values[100]; clrscr(); index=0; for(i=51;i<=300;i++) temp=generate_number(i); if(temp!=0) values[index]=temp;

6 index++; printf("\n"); sum=summation(values,index); printf("\n"); printf("sum = %d",sum); getche(); int generate_number(int x) if((x%9)==0) printf("%d, ",x); return(x); else return 0; int summation(int x[],int n) int s,i; s=0; printf("\n"); for(i=0;i<n;i++) s=s+x[i]; return(s); 3(a) Is it a good approach to use goto statement? Explain your opinion. Let us have an iterative example. We want to find out sum of first 10 natural integers. A program segment is written below. sum=0; count=1; e1: sum=sum+count; count=count+1; if(count<=10) goto e1;

7 In this above sum and count are assigned 0 and 1 initially in the first two statements. The third statement sum=sum+count is preceded by e1. Here e1 is a label of that statement. The value of count in incremented by 1 in the immediate next statement and in the last statement value of count is checked. If the value is below or equal to 10 then using goto statement the control jumps from last statement to third statement and the process is iterated repeatedly until the value of count exceeds 10. This above program segment can easily be written using control structure. Using for loop, we can write, sum=0; for(count=1;count<=10;count++) sum=sum+count; This above control structure implementation is simpler and more professional. Therefore I believe that usage of goto statement should be avoided. (b) In what ways does switch-break statement differ from if-else if-else statement? An example of if statement is if(x==5)printf( Five ); This above example is simple but it can be nested as follows: if (x==0) printf( Zero ); else if (x==1) printf( One ); else if (x==2) printf( Two ); else if (x=3) printf( Three ); else printf( More than 3 ); This above statement can also be written using switch statement as follows: switch(x) case 0: printf( Zero ); break; case 1: printf( One ); break; case 2: printf( Two ); break; case 3: printf( Three ); break; default: printf( More than 3 ); break;

8 Therefore, a switch statement is differed from nested if else statement in above manner. (c) Write a program in C to determine whether a number is a prime or not. #include <conio.h> void main() int num, rem; clrscr(); printf( Enter a positive integer value: ); scanf( %d,&num); if((num==1) (num==2) (num==3))printf( The number is prime ); else rem=num%2; if(rem!=0) printf( The number is not prime ); getche(); (d) The number in a sequence are called Fibonacci numbers. Write a C program using for loop to calculate and print the first 20 Fibonacci number. #include <conio.h> void main() int f1, f2, f3, i; f1=1; f2=1; clrscr(); printf( %d,f1); printf( %d,f2); for(i=3;i<=20;i++) f3=f2+f1; printf( %d,f3); f1=f2; f2=f3;

9 getche(); 4(a) What is an array? Define a two-dimensional integer array and input data values of 4 rows and 5 columns each. An array is a series of objects where all the objects are of same type. The general form of declaration of array is <storage class> <data type> array_name[expression]; For example, an array named x is declared with the size of 10 objects of all integer types int x[10]; A two dimensional integer array is defined with 4 rows and 5 column matrix below. int matrix[4][5]=7, 3, 6, 9, 4, 10, 5, 1, 8, 7, 8, 6, 11, 13, 7, 5, 6, 8, 13, 16; (b) Write a program extract a portion of a character string and print the extracted string. Assume that m characters are extracted starting with nth character. #include<stdio.h> #include<string.h> #include<conio.h> main() char st[100]; int x,i,y,l; clrscr(); printf("enter the string\n"); gets(st); l=strlen(st); printf("how many char you want to extract "); scanf("%d",&x); printf("from where to? " ); scanf("%d",&y); printf("the extracted part of string is=\n"); for(i=0;i<y-1;i++) printf("%c\n",st[i]); for(i=(y+x-1); i<l; i++)

10 getch(); printf("%c\n",st[i]); (c) What are different types of string handling functions? Write a program to test whether the given input string is palindrome or not. Some different string handling functions are: strcat(str1,str2); This function concatenates two strings str1 and str2 and store the resulting string into str1. strcpy(str1,str2); This function copies the string of str2 into str1 strcmp(str1,str2); This function compares str1 and str2. If str1 and str2 matches then it returns 0. strlen(str1); This function computes and returns the length of the string str1. strstr(str1,str2); This function determines the occurrence of str2 in str1. Program: #include <string.h> int main() char a[100], b[100]; printf("enter the string to check if it is a palindrome\n"); gets(a); strcpy(b,a); strrev(b); if( strcmp(a,b) == 0 ) printf("entered string is a palindrome.\n"); else printf("entered string is not a palindrome.\n"); return 0; (d) Describe the limitations of using getchar() and scanf() for reading a string.

11 We know that string is declared in two ways. The most popular approach is using array of character as follows. char text[100]; another approach is to use pointer like char *text; In case of using the previous approach, we can store a string value in the variable text from keyboard using both getchar() and scanf() functions. But the technique will be different. Here we have written a program to get a string input from keyboard i.e. a series of characters will be entered and stored in the variable text until Enter key is pressed. for(count=0;text[count]=getchar()!= \n ;count++); A for loop is used to read a series of characters and store it into an array. But if we use scanf() function, we can easily write the code as follows. scanf( %s, text); Here %s control string is giving us a power to reduce the code and easy writing. 5(a) What is a function definition? Write down the general form of function definition. Function definition is the name of the function following the rules of identifier names along the formal parameters for passing values specified in the argument list and also the type that the value is returned by that function. The general form of a function is shown below: <Return type> function_name(<parameter type> parameter_name) (b) Distinguish between the following: (i) Actual and formal parameter (ii) Automatic and static variables

12 (i) Actual parameter and formal parameters are all parameter used for function, but the parameters in the line of function calling listed in the function calling statement within the braces are known as actual parameters and the variable names with its type definition within the function definition of a user defined function are known as formal parameters. Let us have an example void main() int num; display(num); Here num is the actual parameter when calling the display function. void display(int n) In the above example the variable n with the type of int is treated as formal parameter. (ii) Static variable We have to specify the storage class to make a variable static. If it is not assigned any value then it will give 0 as out put. It is visible to the block in which it is declared and also in the function where it will passed. It retains its value between different function calls. It holds its last value. Static variable should be compile by compiler first. Auto variable It is the default storage class. If it is not assigned any value then it will give garbage value as output. It is visible to the block in which the variable is declared. It retains its value till the control remains in the block in which the variable is declared. Auto variable will compile by the compiler after the static variable. (c) Create a structure which will store name, roll no, and marks of 6 courses that you obtained. This structure will also store total obtained marks. Store all the data for 10 students. Write a program in C to record students information according to their merit position.

13 #include <conio.h> typedef subject_marks float course1_marks; float course2_marks; float course3_marks; float course4_marks; float course5_marks; float course6_marks; float total_marks; ; typedef struct student char name[50]; int roll_no; subject_marks marks; ; void main() struct student student_records[10]; struct student temp_student_record; int count; // reading 10 students records with all course marks clrscr(); for(count=0;count<=9;count++) printf( \nstudent Roll No. %d :,count+1); student_record[count].roll_no=count+1; printf( Name: ); scanf( %s,student_record[count].name); printf( Course 1 Marks: ); scnaf( %f,&student_record[count].marks.course1_marks); printf( Course 2 Marks: ); scnaf( %f,&student_record[count].marks.course2_marks); printf( Course 3 Marks: ); scnaf( %f,&student_record[count].marks.course3_marks); printf( Course 4 Marks: ); scnaf( %f,&student_record[count].marks.course4_marks); printf( Course 5 Marks: ); scnaf( %f,&student_record[count].marks.course5_marks); printf( Course 6 Marks: ); scnaf( %f,&student_record[count].marks.course6_marks); // calculating total marks of each student

14 for(count=0;count<=9;count++) student_record[count].marks.total_marks=(student_record[count].marks.course1_marks+ student_record[count].marks.course2_marks+ student_record[count].marks.course3_marks+ student_record[count].marks.course4_marks+ student_record[count].marks.course5_marks+ student_record[count].marks.course6_marks); // sorting the records according to merit position or total marks in descending order int i, j; for(i=0;i<=8;i++) temp_student_record.roll_no=student_record[i].roll_no; temp_student_record.name=student_record[i].name; temp_student_record.marks.course1_marks=student_record[i].course1_marks; temp_student_record.marks.course2_marks=student_record[i].course2_marks; temp_student_record.marks.course3_marks=student_record[i].course3_marks; temp_student_record.marks.course4_marks=student_record[i].course4_marks; temp_student_record.marks.course5_marks=student_record[i].course5_marks; temp_student_record.marks.course6_marks=student_record[i].course6_marks; for(j=i;j<=9;j++) if (student_record[j].total_marks>temp_student_record.total_marks) student_record[i].roll_no=student_record[i].roll_no; student_record[i].name=student_record[i].name; student_record[i].marks.course1_marks=student_record[j].course1_marks; student_record[i].marks.course2_marks=student_record[j].course2_marks; student_record[i].marks.course3_marks=student_record[j].course3_marks; student_record[i].marks.course4_marks=student_record[j].course4_marks; student_record[i].marks.course5_marks=student_record[j].course5_marks; student_record[i].marks.course6_marks=student_record[j].course6_marks; student_record[j].roll_no=student_record[i].roll_no; student_record[j].name=student_record[i].name; student_record[j].marks.course1_marks=temp_student_record.course1_marks; student_record[j].marks.course2_marks=temp_student_record.course2_marks; student_record[j].marks.course3_marks=temp_student_record.course3_marks; student_record[j].marks.course4_marks=temp_student_record.course4_marks; student_record[j].marks.course5_marks=temp_student_record.course5_marks; student_record[j].marks.course6_marks=temp_student_record.course6_marks;

15 // displaying the sorted list clrscr(); printf( The sorted list according to merit position ); printf( \n Roll No. Name Total Marks Position ); for(i=0;i<=9;i++) printf( \n%d %s %f %dst, student_record[i].roll_no, student_record[i].name, student_record[i].total_marks,i); getche(); (d) What do you mean by Call by value and Call by reference? Let us have an example below. void main() swap(p,q); void swap(int x, int y) int temp; temp = x; /* save the value of x */ x = y; /* put y into x */ y = temp; /* put temp into y */ return; In above program segment, function swap is called from the main function with the values substituted in the parameters i.e. the value of variable p is substituted in variable x in swap function as well as value of q is in variable y respectively. This is known as Call by values. In the same way but instead of using call by values, we can use pointers or variables that hold the address of the values whose are to be operated. This is known as Call by reference and illustrated below. void swap(int *x, int *y) int temp; temp = *x; /* save the value at address x */ *x = *y; /* put y into x */ *y = temp; /* put temp into y */

16 return; 6(a) Describe the different types of file opening mode. The different file open modes also the corresponding file types are listed below: Opening modes File type Description Read only Mode r If a file exist, then the file is opened in read only mode Write only Mode w If a file exist, then it is destroyed and new file is created and opened for write only mode Both read and write Mode r+, w+ w+ will destroy the file if exist and new file will be created Append Mode only a If a file exists, it is opened for adding new information at the end of the file. If the file does not exist then a new file is created. Both read and append Mode (b) Describe about the error handling in file operation. a+ If a file exist then it is opened both for reading and appending, if doesn t exist then a new file is created C does not provide direct support for error handling also known as exception handling. By convention, the programmer is expected to prevent errors from occurring in the first place, and test return values from functions. For example, -1 and NULL are used in several functions. In a scenario where there is an unavoidable error and no way to recover from it, a C programmer usually tries to log the error and "gracefully" terminate the program. Let us have the following example. main() char *filename; FILE *fp1, *fp2; int i, number; fp1 = fopen("test", "w"); for(i = 10; i <= 100; i += 10) putw(i, fp1); fclose(fp1); printf("\ninput filename\n"); open_file: scanf("%s", filename); if((fp2 = fopen(filename,"r")) == NULL)

17 printf("cannot open the file.\n"); printf("type filename again.\n\n"); goto open_file; else for(i = 1; i <= 20; i++) number = getw(fp2); if(feof(fp2)) printf("\nran out of data.\n"); break; else printf("%d\n", number); fclose(fp2); In the above program we see that the file is opened with read only mode using the pointer fp and checked that whether the pointer value fp is null or not. If it is null then an error message is generated Cannot open the file and requested to retype the filename again. (c) Using the following declarations int x=10, y=10; int *p1=qx, *p2=qy; Determine the value of each of the following expression (i) (*p1)++ (ii) *p1+(*p2)-- (iii) --(*p2) (iv) ++(*p2)-*p1 Let us have the following assumptions. F8E qx F8E 10 x F8C qy F8C 10 y (i) (ii) F8F F19

18 (iii) F8B (iv) (d) A file named DATA contains some integer number. Write a file program which will produce all odd numbers in a file named ODD and all even numbers in a file named EVEN. #include <conio.h> #include <dos.h> void main() int i; FILE *fp; fp=fopen("sample.dat","w"); if(fp==null)printf("file cannot be opened!"); else clrscr(); printf("data are being written... \n"); for(i=1;i<=100;i++) fprintf(fp,"%d ",i); printf("%d ",i); delay(100); fclose(fp); printf("\ndata Saved."); getche(); In the above program SAMPLE.DAT file is created and 100 natural integers are written in the SAMPLE.DAT file. In the next program the abovementioned file is opened in read only mode and each and every integer is checked whether is odd or even and written into ODD.DAT and EVEN.DAT files respectively. #include <conio.h> void main() int num; FILE *fpt, *fpt1, *fpt2; fpt=fopen("sample.dat","r");

19 if(fpt==null) printf("file cannot be opened!"); getche(); else fpt1=fopen("odd.dat","w"); fpt2=fopen("even.dat","w"); printf("\ndata being extracted and saved in ODD and EVEN file..."); while((fscanf(fpt,"%d ",&num))!=eof) if((num%2)==0) fprintf(fpt2,"%d ",num); else fprintf(fpt1,"%d ",num); fclose(fpt1); fclose(fpt2); printf("\ndata saved."); getche(); fclose(fpt);

Test Paper 3 Programming Language Solution Question 1: Briefly describe the structure of a C program. A C program consists of (i) functions and (ii) statements There should be at least one function called

More information

'C' Programming Language

'C' Programming Language F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax

More information

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

Multiple Choice Questions ( 1 mark)

Multiple Choice Questions ( 1 mark) Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s

More information

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

Questions Bank. 14) State any four advantages of using flow-chart Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State

More information

CS6202 - PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1. W hat are Keywords? Keywords are certain reserved words that have standard and pre-defined meaning in C. These keywords can be used only for their

More information

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array? 1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The

More information

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

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

Computers Programming Course 7. Iulian Năstac

Computers Programming Course 7. Iulian Năstac Computers Programming Course 7 Iulian Năstac Recap from previous course Operators in C Programming languages typically support a set of operators, which differ in the calling of syntax and/or the argument

More information

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

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

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

More information

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

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

More information

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and

More information

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1 (a) List any four relational operators.

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

About Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals

More information

Chapter 21: Introduction to C Programming Language

Chapter 21: Introduction to C Programming Language Ref. Page Slide 1/65 Learning Objectives In this chapter you will learn about: Features of C Various constructs and their syntax Data types and operators in C Control and Loop Structures in C Functions

More information

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

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 Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.

More information

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

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size]; Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data

More information

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE COURSE TITLE C LANGUAGE DETAILED SYLLABUS SR.NO NAME OF CHAPTERS & DETAILS HOURS ALLOTTED 1 INTRODUCTION TO C LANGUAGE About C Language Advantages of C Language Disadvantages of C Language A Sample Program

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

More information

CHAPTER 4 FUNCTIONS. 4.1 Introduction

CHAPTER 4 FUNCTIONS. 4.1 Introduction CHAPTER 4 FUNCTIONS 4.1 Introduction Functions are the building blocks of C++ programs. Functions are also the executable segments in a program. The starting point for the execution of a program is main

More information

Lecture 02 C FUNDAMENTALS

Lecture 02 C FUNDAMENTALS Lecture 02 C FUNDAMENTALS 1 Keywords C Fundamentals auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void

More information

Model Viva Questions for Programming in C lab

Model Viva Questions for Programming in C lab Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous

More information

VARIABLES AND CONSTANTS

VARIABLES AND CONSTANTS UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data

More information

Question Bank (SPA SEM II)

Question Bank (SPA SEM II) Question Bank (SPA SEM II) 1. Storage classes in C (Refer notes Page No 52) 2. Difference between function declaration and function definition (This question is solved in the note book). But solution is

More information

Fundamentals of Computer Programming Using C

Fundamentals of Computer Programming Using C CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar Faculty Name: Ami D. Trivedi Class: FYBCA Subject: US01CBCA01 (Fundamentals of Computer Programming Using C) *UNIT 3 (Structured Programming, Library Functions

More information

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

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

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

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

Government Polytechnic Muzaffarpur.

Government Polytechnic Muzaffarpur. Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

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

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

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

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

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

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

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

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: 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

More information

Bil 104 Intiroduction To Scientific And Engineering Computing. Lecture 7

Bil 104 Intiroduction To Scientific And Engineering Computing. Lecture 7 Strings and Clases BIL104E: Introduction to Scientific and Engineering Computing Lecture 7 Manipulating Strings Scope and Storage Classes in C Strings Declaring a string The length of a string Copying

More information

Computer Programming Unit 3

Computer Programming Unit 3 POINTERS INTRODUCTION Pointers are important in c-language. Some tasks are performed more easily with pointers such as dynamic memory allocation, cannot be performed without using pointers. So it s very

More information

Vidyalankar F.Y. Diploma : Sem. II [CD/CM/CO/CW/DE/ED/EE/EI/EJ/EN/EP/ET/EV/EX/IC/IE/IF/IS/IU/MU] Programming in C

Vidyalankar F.Y. Diploma : Sem. II [CD/CM/CO/CW/DE/ED/EE/EI/EJ/EN/EP/ET/EV/EX/IC/IE/IF/IS/IU/MU] Programming in C F.Y. Diploma : Sem. II [CD/CM/CO/CW/DE/ED/EE/EI/EJ/EN/EP/ET/EV/EX/IC/IE/IF/IS/IU/MU] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 100 Q.1 Attempt any TEN of the following : [20]

More information

Kadi Sarva Vishwavidyalaya, Gandhinagar

Kadi Sarva Vishwavidyalaya, Gandhinagar Kadi Sarva Vishwavidyalaya, Gandhinagar MASTERS OF COMPUTER APPLICATION (MCA) Semester I (First Year) Subject: MCA-101 Programming for Logic Building (LDPL) SUB Teaching scheme Examination scheme Total

More information

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

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

Array Initialization

Array Initialization Array Initialization Array declarations can specify initializations for the elements of the array: int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 ; initializes primes[0] to 2, primes[1] to 3, primes[2]

More information

ARRAYS(II Unit Part II)

ARRAYS(II Unit Part II) ARRAYS(II Unit Part II) Array: An array is a collection of two or more adjacent cells of similar type. Each cell in an array is called as array element. Each array should be identified with a meaningful

More information

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS Syllabus: Pointers and Preprocessors: Pointers and address, pointers and functions (call by reference) arguments, pointers and arrays, address arithmetic, character pointer and functions, pointers to pointer,initialization

More information

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

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Code: 17212 Model Answer Page No: 1/28 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model

More information

Chapter 8 Character Arrays and Strings

Chapter 8 Character Arrays and Strings Chapter 8 Character Arrays and Strings INTRODUCTION A string is a sequence of characters that is treated as a single data item. String constant: String constant example. \ String constant example.\ \ includes

More information

Unit 6 Files. putchar(ch); ch = getc (fp); //Reads single character from file and advances position to next character

Unit 6 Files. putchar(ch); ch = getc (fp); //Reads single character from file and advances position to next character 1. What is File management? In real life, we want to store data permanently so that later on we can retrieve it and reuse it. A file is a collection of bytes stored on a secondary storage device like hard

More information

IV Unit Second Part STRUCTURES

IV Unit Second Part STRUCTURES STRUCTURES IV Unit Second Part Structure is a very useful derived data type supported in c that allows grouping one or more variables of different data types with a single name. The general syntax of structure

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

I YEAR II SEMESTER COMPUTER SCIENCE PROGRAMMING IN C

I YEAR II SEMESTER COMPUTER SCIENCE PROGRAMMING IN C I YEAR II SEMESTER COMPUTER SCIENCE 3-2-108 UNIT I PROGRAMMING IN C Introduction to C: Introduction Structure of C Program Writing the first C Program File used in C Program Compiling and Executing C Programs

More information

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1 NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.

More information

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

UNIT III (PART-II) & UNIT IV(PART-I) UNIT III (PART-II) & UNIT IV(PART-I) Function: it is defined as self contained block of code to perform a task. Functions can be categorized to system-defined functions and user-defined functions. System

More information

C Programming Multiple. Choice

C Programming Multiple. Choice C Programming Multiple Choice Questions 1.) Developer of C language is. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in. a.) 1970 c.) 1976 b.) 1972 d.) 1980

More information

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

(i) Describe in detail about the classification of computers with their features and limitations(10) UNIT I - INTRODUCTION Generation and Classification of Computers- Basic Organization of a Computer Number System Binary Decimal Conversion Problems. Need for logical analysis and thinking Algorithm Pseudo

More information

Computers Programming Course 12. Iulian Năstac

Computers Programming Course 12. Iulian Năstac Computers Programming Course 12 Iulian Năstac Recap from previous course Strings in C The character string is one of the most widely used applications that involves vectors. A string in C is an array of

More information

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Write a C program using arrays and structure

Write a C program using arrays and structure 03 Arrays and Structutes 3.1 Arrays Declaration and initialization of one dimensional, two dimensional and character arrays, accessing array elements. (10M) 3.2 Declaration and initialization of string

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Adapted from the slides Revisões sobre Programação em C, Sérgio Crisóstomo Compilation #include int main()

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Tutorial No. 2 - Solution (Overview of C)

Tutorial No. 2 - Solution (Overview of C) Tutorial No. 2 - Solution (Overview of C) Computer Programming and Utilization (2110003) 1. Explain the C program development life cycle using flowchart in detail. OR Explain the process of compiling and

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

Unit 3 Decision making, Looping and Arrays

Unit 3 Decision making, Looping and Arrays Unit 3 Decision making, Looping and Arrays Decision Making During programming, we have a number of situations where we may have to change the order of execution of statements based on certain conditions.

More information

Structured Programming Approach

Structured Programming Approach Software Engineering MU 2. Project Scheduling CGBS 2015-2016 Structured Programming Approach FIRST YEAR HUMANITIES & SCIENCE (FEC205) MRS.ANURADHA BHATIA M.E. Computer Engineering Table of Contents 1.

More information

Computer Programming Unit v

Computer Programming Unit v READING AND WRITING CHARACTERS We can read and write a character on screen using printf() and scanf() function but this is not applicable in all situations. In C programming language some function are

More information

Department of Computer Applications

Department of Computer Applications Sheikh Ul Alam Memorial Degree College Mr. Ovass Shafi. (Assistant Professor) C Language An Overview (History of C) C programming languages is the only programming language which falls under the category

More information

Procedural programming with C

Procedural programming with C Procedural programming with C Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada August 11, 2016 1 / 77 Functions Similarly to its mathematical

More information

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

M1-R4: Programing and Problem Solving using C (JAN 2019) M1-R4: Programing and Problem Solving using C (JAN 2019) Max Marks: 100 M1-R4-07-18 DURATION: 03 Hrs 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter

More information

UNIT 3 FUNCTIONS AND ARRAYS

UNIT 3 FUNCTIONS AND ARRAYS UNIT 3 FUNCTIONS AND ARRAYS Functions Function definitions and Prototypes Calling Functions Accessing functions Passing arguments to a function - Storage Classes Scope rules Arrays Defining an array processing

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

MODULE 3: Arrays, Functions and Strings

MODULE 3: Arrays, Functions and Strings MODULE 3: Arrays, Functions and Strings Contents covered in this module I. Using an Array II. Functions in C III. Argument Passing IV. Functions and Program Structure, locations of functions V. Function

More information

Computer Programming. Decision Making (2) Loops

Computer Programming. Decision Making (2) Loops Computer Programming Decision Making (2) Loops Topics The Conditional Execution of C Statements (review) Making a Decision (review) If Statement (review) Switch-case Repeating Statements while loop Examples

More information

SUMMER 13 EXAMINATION Model Answer

SUMMER 13 EXAMINATION Model Answer Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011

Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011 Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011 Autumn 2015 Lecture 3, Simple C programming M. Eriksson (with contributions from A. Maki and

More information

UNIT III ARRAYS AND STRINGS

UNIT III ARRAYS AND STRINGS UNIT III ARRAYS AND STRINGS Arrays Initialization Declaration One dimensional and Two dimensional arrays. String- String operations String Arrays. Simple programs- sorting- searching matrix operations.

More information

OBJECTIVE QUESTIONS: Choose the correct alternative:

OBJECTIVE QUESTIONS: Choose the correct alternative: OBJECTIVE QUESTIONS: Choose the correct alternative: 1. Function is data type a) Primary b) user defined c) derived d) none 2. The declaration of function is called a) function prototype b) function call

More information

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

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data

More information

Subject: PIC Chapter 2.

Subject: PIC Chapter 2. 02 Decision making 2.1 Decision making and branching if statement (if, if-, -if ladder, nested if-) Switch case statement, break statement. (14M) 2.2 Decision making and looping while, do, do-while statements

More information

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:

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: Q1. Explain the structure of a C program Structure of the C program is shown below: Preprocessor Directives Global Declarations Int main (void) Local Declarations Statements Other functions as required

More information

The syntax of structure declaration is. struct structure_name { type element 1; type element 2; type element n;

The syntax of structure declaration is. struct structure_name { type element 1; type element 2; type element n; Structure A structure is a user defined data type. We know that arrays can be used to represent a group of data items that belong to the same type, such as int or float. However we cannot use an array

More information

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING SIDDARTHA INSTITUTE OF SCIENCE AND TECHNOLOGY:: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : PROGRAMMING FOR PROBLEM SOLVING (18CS0501) Course & Branch

More information

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

COP 3223 Introduction to Programming with C - Study Union - Spring 2018 COP 3223 Introduction to Programming with C - Study Union - Spring 2018 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

Introduction to C Language (M3-R )

Introduction to C Language (M3-R ) Introduction to C Language (M3-R4-01-18) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in OMR answer sheet supplied with the question paper, following

More information

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows Unti 4: C Arrays Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type An array is used to store a collection of data, but it is often more useful

More information

Branching is deciding what actions to take and Looping is deciding how many times to take a certain action.

Branching is deciding what actions to take and Looping is deciding how many times to take a certain action. 3.0 Control Statements in C Statements The statements of a C program control the flow of program execution. A statement is a command given to the computer that instructs the computer to take a specific

More information

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities SOLUTION OF CONTINUOUS INTERNAL EVALUATION TEST -1 Date : 27-02 2018 Marks:60 Subject & Code : Programming in C and Data Structures- 17PCD23 Name of faculty : Dr. J Surya Prasad/Mr. Naushad Basha Saudagar

More information

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

Computer Science & Information Technology (CS) Rank under AIR 100. Examination Oriented Theory, Practice Set Key concepts, Analysis & Summary GATE- 2016-17 Postal Correspondence 1 C-Programming Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts, Analysis

More information

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming CSE101-Lec#18 Multidimensional Arrays Application of arrays Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Defining and processing 1D array 2D array Applications of arrays 1-D array A

More information

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

Flow of Control. Selection. if statement. True and False in C False is represented by any zero value. switch Flow of Control True and False in C Conditional Execution Iteration Nested Code(Nested-ifs, Nested-loops) Jumps 1 True and False in C False is represented by any zero value The int expression having the

More information

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler

More information

Decision Making -Branching. Class Incharge: S. Sasirekha

Decision Making -Branching. Class Incharge: S. Sasirekha Decision Making -Branching Class Incharge: S. Sasirekha Branching The C language programs presented until now follows a sequential form of execution of statements. Many times it is required to alter the

More information

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered )   FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING ( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types

More information

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); }

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); } C Program Output #include main () { printf ( Hi everyone\n ); Hi everyone #include main () { printf ( Hi everyone\n ); #include and main are Keywords (or Reserved Words) Reserved Words

More information

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++ CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

More information

A control structure refers to the way in which the Programmer specifies the order of executing the statements

A control structure refers to the way in which the Programmer specifies the order of executing the statements Control Structures A control structure refers to the way in which the Programmer specifies the order of executing the statements The following approaches can be chosen depending on the problem statement:

More information

ET156 Introduction to C Programming

ET156 Introduction to C Programming ET156 Introduction to C Programming g Unit 22 C Language Elements, Input/output functions, ARITHMETIC EXPRESSIONS AND LIBRARY FUNCTIONS Instructor : Stan Kong Email : skong@itt tech.edutech.edu General

More information

Basic memory model Using functions Writing functions. Basics Prototypes Parameters Return types Functions and memory Names and namespaces

Basic memory model Using functions Writing functions. Basics Prototypes Parameters Return types Functions and memory Names and namespaces Basic memory model Using functions Writing functions Basics Prototypes Parameters Return types Functions and memory Names and namespaces When a program runs it requires main memory (RAM) space for Program

More information