Scheme of valuations-test 3 PART 1

Size: px
Start display at page:

Download "Scheme of valuations-test 3 PART 1"

Transcription

1 Scheme of valuations-test 3 PART 1 1 a What is string? Explain with example how to pass string to a function. Ans A string constant is a one-dimensional array of characters terminated by a null ( \0 ) for example: char name[ ] = H, E, L, L, O, \0 ; or char name[ ] = HELLO ; \0 is called as null character. ASCII value of \0 is 0. String can be passed into function by two ways B Ans (a) Call by value (b) Call by reference Example: #include <stdio.h> void strrcpy(char target[],char source[]); int main() char t1[0],s1[0]; puts("enter the string"); gets(s1); strrcpy(t1,s1); printf("source=%s\n",s1); printf("target=%s\n",t1); return 0; void strrcpy(char target[],char source[]) int i=0; while(source[i]!='\0') target[i]=source[i]; i++; target[i]='\0'; Write a program to input a string and calculate and print the length of the string without using strlen(). #include<stdio.h> void main(void) 1 1

2 A Ans char str1[5]; int len=0; printf("enter string whose length is to be found:"); gets(str1); while(str1[len]!='\0') len++; //here the length of string is calculated. printf("length of the string is %d", len); Write a program to search a name in a list of names using binary search technique. #include<stdio.h> #include<stdlib.h> #include<string.h> void main() int i,n,low,high,mid; char a[50][50],key[0]; printf("\n Enter the number of names: "); scanf("%d",&n); printf("\nenter the names in ascending order\n"); for(i=0;i<n;i++) scanf("%s",&a[i]); printf("\nenter the name to be searched\n"); scanf("%s",&key); low=0; high=n-1; while(low<=high) mid=(low+high)/; if(strcmp(key,a[mid])==0) printf("key found at position %d\n",mid+1); exit(0); else if(strcmp(key,a[mid])>0) low=mid+1; else

3 high=mid-1; printf("\nname not found\n"); b Explain strcpy(), strcat(), strlen(), strncpy(), strcmp() with examples. Ans Strcpy(): Syntax of strcpy: strcpy(target,source); Copies the contents of the from string including the null character, to the string Ex: char s1[1],s[9]= Good Day ; strcpy(s1,s); strcat(): This function concatenates the source string at the end of the target string. For example, Good and Morning on concatenation would result into a string Good Morning. void main() char source[]="morning"; char target[0]="good "; strcat(target,source); puts(target); Strlen() : String length: strlen() int strlen(const char* string); Strncpy(): returns the length of the string, i.e., the no. of chars in the string excluding the null char Returns zero if the string is empty char* strncpy(target, source, int size); Size specifies the maximum number of chars that can be moved at a time If the size of the from string is equal to or greater than size, then size chars

4 are moved If the from string is smaller than size, the entire string is copied and then null chars are inserted into the destination string until exactly size chars have been copied Strcmp(): This is a function which compares two strings to find out whether they are same or different. The two strings are compared character by character until there is a mismatch or end of one of the strings is reached, whichever occurs first. If the two strings are identical, strcmp( ) returns a value zero. If they re not, it returns the numeric difference between the 0. ASCII values of the first non-matching pair of characters. PART 3 a What is Structure? How structure is different from an array? Explain declaration of a structure with an example. Ans Structure is a collection of elements of different data type. The syntax is shown below: struct structure_name data_type member1; data_type member; data_type member3; ; The variables that are used to store the data are called members of the structure. We can create the structure for a person as shown below: struct person char name[50]; int cit_no; float salary; ; This declaration above creates the derived data type struct person. Array is the collection items of similar datatype. Structure Variable Declaration A structure can be declared using methods: 1) Tagged Structure When a structure is defined, it creates a user-defined type but, no storage is allocated. For the above structure of person, variable can be declared as: struct person 1

5 b char name[50]; int cit_no; float salary; ; Inside main function: struct person p1, p; Here the above statement declares that the variables p1 and p are variables of type struct person. Once the structure variable is declared, the compiler allocates memory for the structure variables. The size of the memory allocated is the sum of size of individual members. ) Type Defined Structure Another way of creating sturcture variable using the keyword typedef is: typedef struct person char name[50]; int cit_no; float salary; EMP; Inside main function: EMP p1,p ; Here the above statement declares that the variables p1 and p are variables of type EMP(which is of type as struct person).. Structure Variable Initialization For ex: struct person char name[50]; int cit_no; float salary; ; struct person p1="ram",, 3000; Accessing Members of a Structure Member operator(.) can be used for accessing members of a structure. Any member of a structure can be accessed as: structure_variable_name.member_name By specifying p1.name, we can access the name ram. By specifying p1.salary, we can access the value The various values can be accessed and printed as shown below: printf("%s", p1.name); printf("%f", p1.salary); We can read the members of a structure as shown below: gets(p1.name); or scanf("%s", p1.name); scanf("%f",&p1.salary);. Explain how the structure variable passed as a parameter to a function. And also, write a program to add two complex numbers by passing structure to a function.

6 Passing Structure by Value A structure-variable can be passed to the function as an argument as normal variable. If structure is passed by value, change made in structure-variable in functiondefinition does not reflect in original structure variable in calling-function. #include <stdio.h> struct comp int real; float img; ; Struct comp Add(struct comp c1,struct comp c, struct comp c3) // Adding complex numbers c1 and d and storing it in c3 c3.real=c1.real+c.real; c3.img=c1.img+c.img; return(c3); void main() struct comp c1, c, c3; printf("first complex number \n"); printf("enter real part: "); scanf("%d",&c1.real); printf("enter imaginary part: "); scanf("%f",&c1.img); printf("second complex number \n"); printf("enter real part: "); scanf("%d",&c.real); printf("enter imaginary part: "); scanf("%f",&c.img); c3=add(c1, c); //passing structure variables c1 and c by value whereas passing // structure variable c3 by reference printf("sum of complex numbers = %d + i %d",c3.real, c3.img); Write a C program to maintain a record of "n" student details using an array of structures with four fields (Roll number, Name, marks, and Grade). Each field is of an appropriate data type. Print the marks of the student given name as input. 8 Ans #include <stdio.h> #include <stdlib.h> struct Student

7 int Marks,RollNo; char Name[30],Grade; ; void main() struct Student s[0]; int i, Num, Found = 0; char StudName[30]; printf("\nenter the number of students\n"); scanf("%d", &Num); printf("\nenter Student Details\n"); for(i=0;i<num;i++) printf("\nstudent %d\n\nrollno : ", i+1); scanf("%d", &s[i].rollno); printf("\nname : "); scanf("%s",&s[i].name); printf("\nmarks : "); scanf("%d",&s[i].marks); printf("\ngrade : "); scanf("%s",&s[i].grade); printf("\n\n\n"); printf("\nenter the name to display marks\n"); scanf("%s",&studname); for(i=0;i<num;i++) if(strcmp(studname,s[i].name)==0) Found = 1; printf("\nmarks obtained by %s is %d\n", s[i].name, s[i].marks); exit(0); if(found == 0) printf("\nno student by name %s found\n", StudName); PART 3

8 5 a What is FILE? Explain the various MODES in which a file can be created and open successfully. A computer file is used to store data in digital format like plain text, image data or any other content. Computer files can be considered as the digital counterpart of paper documents, which traditionally are kept in office. While doing programming, you keep your source code in text files with different extensions. For example, C programming files have.c extension, Java programming files have.java extension. File Operations 1) Creating a new file ) Opening an existing file 3) Reading from and writing information to a file ) Closing a file DEFINING, OPENING AND CLOSING OF FILES Defining a File While working with file, you need to declare a pointer of type FILE. This declaration is needed for communication between file and program. FILE *ptr; Opening a File fopen( ) function can be used to create a new file or to open an existing file This function will initialize an object of the type FILE, which contains all the information necessary to control the stream. The syntax is shown below: FILE *fopen( const char *filename, const char *access_mode ); where filename is string literal, which you will use to name your file. access_mode can have one of the following values: Mode Description r Opens an existing text file for reading purpose w Opens a text file for writing, if it does not exist then a new file is created a Opens a text file for writing in appending mode r+ Opens a text file for reading and writing both Closing a File The file should be closed after reading/writing of a file. fclose( ) function can be used to close a file. The syntax is shown below: int fclose(file *fp); The fclose( ) function returns zero on success or returns EOF(special character) if there is an error b Write a program to read and display a text from the file. void main()

9 FILE *fp; char buff[55]; fp = fopen("student.txt", "r"); if(fp==null) printf( error ); while(!feof(fp)) fscanf(fp, "%s", buff); printf("1 : %s \n", buff ); fclose(fp); P.T.O.

10 6 Given two text documentary files Ramayan.in and Mahabharat.in. Write a C program to create a new file Karnataka.in that appends the contents of the file Ramayan.in to the file Mahabharat.in. Also, calculate the number of words and new lines in the output file. #include <stdio.h> #include <stdlib.h> 8 int main() FILE *fp1,*fp,*fp3; char x[0],y[0],ch; int words=0,lines=0; fp1=fopen("ra.txt","r"); if(fp1==null) printf("error in file1"); fp=fopen("ma.txt","r"); if(fp==null) printf("error in file"); fp3=fopen("ka.txt","w"); if(fp3==null) printf("error in file3"); while(fscanf(fp,"%s",x)!=eof) fprintf(fp3,"%s\n",x); fclose(fp); while(fscanf(fp1,"%s",y)!=eof) fprintf(fp3,"%s\n",y); fclose(fp3); fclose(fp1); fp3=fopen("ka.txt","r"); if(fp3==null) printf("error in file3"); while ((ch=getc(fp3))!= EOF) // Increment word count if new line or space character if (ch == ' ' ch == '\n') ++words; return 0; // Increment line count if new line character if (ch == '\n') lines++; printf("\nwords and lines in a file are=%d,%d",words,lines);

11 PART 7 a What is pointer? Write a C program using pointers to compute the sum, mean and standard deviation of all elements stored in an array of n real numbers. A pointer is a variable which holds address of another variable or a memorylocation. For ex: c=300; pc=&c; Here pc is a pointer; it can hold the address of variable c & is called reference operator #include<stdio.h> #include<math.h> main() int n,i; float a[0],sum=0,mean,sumd=0, variance, stddev; printf("enter the No of elements \n"); scanf("%d",&n); float *p; p=&a[0]; for(i=0;i<n;i++) scanf("%f",(a+i)); for(i=0;i<n;i++) sum= sum + *(a+i); mean=sum/n; for(i=0; i<n;i++) sumd=sumd+pow((*p - mean),); p++; variance=sumd/n;

12 stddev= sqrt(variance); printf("\nsum: %f",sum); printf("\nmean: %f",mean); printf("\n Standard Deviation: %f",stddev); b Explain dangling pointer and array of pointers with example? A dangling pointer is one that has a value (not NULL) which refers to some memory which is not valid for the type of object you expect. For example if you set a pointer to an object then overwrote that memory with something else unrelated or freed the memory if it was dynamically allocated. Consider an array: int arr[]; The name of the array always points to the first element of an array. Here, address of first element of an array is &arr[0]. Also, arr represents the address of the pointer where it is pointing. Hence, &arr[0] is equivalent to arr. Also, value inside the address &arr[0] and address arr are equal. Value in address &arr[0] is arr[0] and value in address arr is *arr. Hence, arr[0] is equivalent to *arr. Similarly, &a[1] is equivalent to (a+1) AND, a[1] is equivalent to *(a+1). &a[] is equivalent to (a+) AND, a[] is equivalent to *(a+). &a[3] is equivalent to (a+1) AND, a[3] is equivalent to *(a+3). &a[i] is equivalent to (a+i) AND, a[i] is equivalent to *(a+i). You can declare an array and can use pointer to alter the data of an array. Example: Program to access elements of an array using pointer. #include<stdio.h> void main() int data[5], i; printf("enter elements: "); for(i=0;i<5;++i) scanf("%d", data+i); printf("you entered: "); for(i=0;i<5;++i) printf("%d ",*(data+i) ); Output: Enter elements: You entered: What do you mean by Dynamic memory allocation? Explain malloc (), calloc(), realloc() and free()? Dynamic memory allocation is the process of allocating memory-space during execution-time 8

13 i.e. run time. If there is an unpredictable storage requirement, then the dynamic allocation technique is used. This allocation technique uses predefined functions to allocate and release memory for data during execution-time. There are library functions for dynamic memory allocation: 1) malloc() ) calloc() 3) free() ) realloc() These library functions are defined under "stdlib.h" malloc() The name malloc stands for "memory allocation". This function is used to allocate the requirement memory-space during execution-time. The syntax is shown below: data_type *p; p=(data_type*)malloc(size); here p is pointer variable data_type can be int, float or char size is number of bytes to be allocated If memory is successfully allocated, then address of the first byte of allocated space is returned. If memory allocation fails, then NULL is returned. For ex: ptr=(int*)malloc(100*sizeof(int)); The above statement will allocate 00 bytes assuming sizeof(int)= bytes. Calloc The name calloc stands for "contiguous allocation". This function is used to allocate the required memory-size during execution-time and at the same time, automatically initialize memory with 0's. The syntax is shown below: data_type *p; p=(data_type*)calloc(n,size); If memory is successfully allocated, then address of the first byte of allocated space is returned. If memory allocation fails, then NULL is returned. The allocated memory is initialized automatically to 0's. For ex: ptr=(int*)calloc(5,sizeof(int)); The above statement allocates contiguous space in memory for an array of 5 elements each of size of int, i.e., bytes. free Dynamically allocated memory with either calloc() or malloc() does not get return on its own. The programmer must use free() explicitly to release space. The syntax is shown below: free(ptr); This statement causes the space in memory pointed by ptr to be deallocated. realloc() If the previously allocated memory is insufficient or more than sufficient. Then, you can change memory-size previously allocated using realloc(). 1.5*

14 The syntax is shown below: ptr=(data_type*)realloc(ptr,newsize); PART 5 9 a What do you mean by data structure? Explain primitive and non-primitive data types. A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the record, the table, the tree, and so on. Any data structure is designed to organize data to suit a specific purpose so that it can be accessed and worked with in appropriate ways. PRIMITIVE AND NON-PRIMITIVE DATA TYPES Data type specifies the type of data stored in a variable. The data type can be classified into two types: 1) Primitive data type and )Non-Primitive data type Primitive Data Type The primitive data types are the basic data types that are available in most of the programming languages. The primitive data types are used to represent single values. Integer: This is used to represent a number without decimal point. Eg: 1, 90 Float: This is used to represent a number with decimal point. Eg: 5.1, 67.3 Character: This is used to represent single character Eg: C, a String: This is used to represent group of characters. Eg: "M.S.P.V.L Polytechnic College" Boolean: This is used represent logical values either true or false. Non Primitive Data Type The data types that are derived from primary data types are known as non-primitive data types. These datatypes are used to store group of values. The non-primitive data types are Arrays Structure Stacks Linked list Queue Binary tree 1* b Define Stack and Linked List with example and mention the applications. A stack is a special type of data structure where elements are inserted from one end and elements are deleted from the same end. Using this approach, the Last element Inserted is the First element to be deleted Out, and hence, stack is also called LIFO data structure. The various operations performed on stack: Insert: An element is inserted from top end. Insertion operation is called push operation. Delete: An element is deleted from top end. Deletion operation is called pop operation.

15 Overflow: Check whether the stack is full or not. Underflow: Check whether the stack is empty or not. APPLICATIONS OF STACK 1) Conversion of expressions: The compiler converts the infix expressions into postfix expressions using stack. ) Evaluation of expression: An arithmetic expression represented in the form of either postfix or prefix can be easily evaluated using stack. 3) Recursion: A function which calls itself is called recursive function. ) Other applications: To find whether the string is a palindrome, to check whether a given expression is valid or not. Linked List A linked list is a data structure which is collection of zero or more nodes where each node has some information. Normally, node consists of fields 1) info field which is used to store the data or information to be manipulated ) link field which contains address of the next node. Different types of linked list are SLL & DLL Various operations of linked lists 1) Inserting a node into the list ) Deleting a node from the list 3) Search in a list ) Display the contents of list Application Sparse Matrices 10 Define Queue explain its operation with example. What are its applications? 8 #include <stdio.h> #define MAX 50 int queue_array[max], rear = - 1, front = - 1; insert() int add_item; if (rear == MAX - 1) printf("queue Overflow "); else if (front == - 1) //If queue is initially empty front = 0; printf("insert the element in queue : "); scanf("%d", &add_item); rear=rear+1; queue_array[rear]=add_item; //End of insert() delete() if (front == - 1 front > rear) printf("queue Underflow \n"); return ; else

16 printf("element deleted from queue is : %d\n", queue_array[front]); front = front + 1; //End of delete() display() int i; if (front == - 1) printf("queue is empty \n"); else printf("queue is : \n"); for (i = front; i <= rear; i++) printf("%d ", queue_array[i]); printf("\n"); main() int choice; while (1) printf("1.insert element to queue \n"); printf(".delete element from queue \n"); printf("3.display all elements of queue \n"); printf(".quit \n"); printf("enter your choice : "); scanf("%d", &choice); switch (choice) case 1: insert(); break; case : delete(); break; case 3: display(); break; case : exit(1); default: printf("wrong choice \n"); //End of switch //End of while //End of main

PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST-3 Date : 12-05-2016 Marks: 40 Subject & Code : Programming in C and data structures (15PCD23) Sec : F,G,H,I,J,K Name of faculty :Dr J Surya Prasad/Mr.Sreenath M V/Ms.Monika/ Time

More information

Bangalore South Campus

Bangalore South Campus USN: 1 P E PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST 3 Date: 22/11/2017 Time:11:30am- 1.00 pm

More information

MODULE V: POINTERS & PREPROCESSORS

MODULE V: POINTERS & PREPROCESSORS MODULE V: POINTERS & PREPROCESSORS INTRODUCTION As you know, every variable is a memory-location and every memory-location has its address defined which can be accessed using ampersand(&) operator, which

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

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

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

High Performance Programming Programming in C part 1

High Performance Programming Programming in C part 1 High Performance Programming Programming in C part 1 Anastasia Kruchinina Uppsala University, Sweden April 18, 2017 HPP 1 / 53 C is designed on a way to provide a full control of the computer. C is the

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility, there are four library routines known as memory management

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

MODULE 5: Pointers, Preprocessor Directives and Data Structures

MODULE 5: Pointers, Preprocessor Directives and Data Structures MODULE 5: Pointers, Preprocessor Directives and Data Structures 1. What is pointer? Explain with an example program. Solution: Pointer is a variable which contains the address of another variable. Two

More information

Principles of C and Memory Management

Principles of C and Memory Management COMP281 Lecture 9 Principles of C and Memory Management Dr Lei Shi Last Lecture Today Pointer to Array Pointer Arithmetic Pointer with Functions struct Storage classes typedef union String struct struct

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

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

Advanced C Programming and Introduction to Data Structures

Advanced C Programming and Introduction to Data Structures FYBCA Semester II (Advanced C Programming and Introduction to Data Structures) Question Bank Multiple Choice Questions Unit-1 1. Which operator is used with a pointer to access the value of the variable

More information

C Pointers. Abdelghani Bellaachia, CSCI 1121 Page: 1

C Pointers. Abdelghani Bellaachia, CSCI 1121 Page: 1 C Pointers 1. Objective... 2 2. Introduction... 2 3. Pointer Variable Declarations and Initialization... 3 4. Reference operator (&) and Dereference operator (*) 6 5. Relation between Arrays and Pointers...

More information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

int Return the number of characters in string s.

int Return the number of characters in string s. 1a.String handling functions: Function strcmp(const char *s1, const char *s2) strcpy(char *s1, const char *s2) strlen(const char *) strcat(char *s1, Data type returned int Task Compare two strings lexicographically.

More information

C mini reference. 5 Binary numbers 12

C mini reference. 5 Binary numbers 12 C mini reference Contents 1 Input/Output: stdio.h 2 1.1 int printf ( const char * format,... );......................... 2 1.2 int scanf ( const char * format,... );.......................... 2 1.3 char

More information

int marks[10]; // fixed size and fixed address No change in Memory address.

int marks[10]; // fixed size and fixed address No change in Memory address. Dynamic Memory Allocation : Used When we want to allocate memory during run time. int marks[10]; // fixed size and fixed address No change in Memory address. // fixed size. ( no change in size possible

More information

Pointers (part 1) What are pointers? EECS We have seen pointers before. scanf( %f, &inches );! 25 September 2017

Pointers (part 1) What are pointers? EECS We have seen pointers before. scanf( %f, &inches );! 25 September 2017 Pointers (part 1) EECS 2031 25 September 2017 1 What are pointers? We have seen pointers before. scanf( %f, &inches );! 2 1 Example char c; c = getchar(); printf( %c, c); char c; char *p; c = getchar();

More information

Arrays and Pointers. CSE 2031 Fall November 11, 2013

Arrays and Pointers. CSE 2031 Fall November 11, 2013 Arrays and Pointers CSE 2031 Fall 2013 November 11, 2013 1 Arrays l Grouping of data of the same type. l Loops commonly used for manipulation. l Programmers set array sizes explicitly. 2 Arrays: Example

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

Class Information ANNOUCEMENTS

Class Information ANNOUCEMENTS Class Information ANNOUCEMENTS Third homework due TODAY at 11:59pm. Extension? First project has been posted, due Monday October 23, 11:59pm. Midterm exam: Friday, October 27, in class. Don t forget to

More information

Unit IV & V Previous Papers 1 mark Answers

Unit IV & V Previous Papers 1 mark Answers 1 What is pointer to structure? Pointer to structure: Unit IV & V Previous Papers 1 mark Answers The beginning address of a structure can be accessed through the use of the address (&) operator If a variable

More information

Arrays and Pointers. Arrays. Arrays: Example. Arrays: Definition and Access. Arrays Stored in Memory. Initialization. EECS 2031 Fall 2014.

Arrays and Pointers. Arrays. Arrays: Example. Arrays: Definition and Access. Arrays Stored in Memory. Initialization. EECS 2031 Fall 2014. Arrays Arrays and Pointers l Grouping of data of the same type. l Loops commonly used for manipulation. l Programmers set array sizes explicitly. EECS 2031 Fall 2014 November 11, 2013 1 2 Arrays: Example

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

Memory Allocation. General Questions

Memory Allocation. General Questions General Questions 1 Memory Allocation 1. Which header file should be included to use functions like malloc() and calloc()? A. memory.h B. stdlib.h C. string.h D. dos.h 2. What function should be used to

More information

Memory Allocation in C

Memory Allocation in C Memory Allocation in C When a C program is loaded into memory, it is organized into three areas of memory, called segments: the text segment, stack segment and heap segment. The text segment (also called

More information

S.E. Sem. III [CMPN] Data Structures. Primitive Linear Non Linear

S.E. Sem. III [CMPN] Data Structures. Primitive Linear Non Linear S.E. Sem. III [CMPN] Data Structures Time : 3 Hrs.] Prelim Paper Solution [Marks : 80 Q.1(a) Explain different types of data structures with examples. [5] Ans.: Types of Data Structure : Data Structures

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

CSCI 171 Chapter Outlines

CSCI 171 Chapter Outlines Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures

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

Guide for The C Programming Language Chapter 5

Guide for The C Programming Language Chapter 5 1. Differentiate between primitive data type and non-primitive data type. Primitive data types are the basic data types. These data types are used to represent single values. For example: Character, Integer,

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

PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo

PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo 1. (a)what is an algorithm? Draw a flowchart to print N terms of Fibonacci

More information

dynamic memory allocation

dynamic memory allocation Dynamic memory allocation in C The concept of dynamic memory allocation in c language enables the C programmer to allocate memory at runtime. Dynamic memory allocation in c language is possible by 4 functions

More information

Content. In this chapter, you will learn:

Content. In this chapter, you will learn: ARRAYS & HEAP Content In this chapter, you will learn: To introduce the array data structure To understand the use of arrays To understand how to define an array, initialize an array and refer to individual

More information

C programming basics T3-1 -

C programming basics T3-1 - C programming basics T3-1 - Outline 1. Introduction 2. Basic concepts 3. Functions 4. Data types 5. Control structures 6. Arrays and pointers 7. File management T3-2 - 3.1: Introduction T3-3 - Review of

More information

S.E. Sem. III [INFT] Data Structures & Analysis. Primitive Linear Non Linear

S.E. Sem. III [INFT] Data Structures & Analysis. Primitive Linear Non Linear S.E. Sem. III [INFT] Data Structures & Analysis Time : 3 Hrs.] Prelim Paper Solution [Marks : 80 Q.1(a) Explain different types of data structures with examples. [5] Ans.: Types of Data Structure : Data

More information

8. Characters, Strings and Files

8. Characters, Strings and Files REGZ9280: Global Education Short Course - Engineering 8. Characters, Strings and Files Reading: Moffat, Chapter 7, 11 REGZ9280 14s2 8. Characters and Arrays 1 ASCII The ASCII table gives a correspondence

More information

Arrays and Pointers (part 1)

Arrays and Pointers (part 1) Arrays and Pointers (part 1) CSE 2031 Fall 2012 Arrays Grouping of data of the same type. Loops commonly used for manipulation. Programmers set array sizes explicitly. Arrays: Example Syntax type name[size];

More information

C-LANGUAGE CURRICULAM

C-LANGUAGE CURRICULAM C-LANGUAGE CURRICULAM Duration: 2 Months. 1. Introducing C 1.1 History of C Origin Standardization C-Based Languages 1.2 Strengths and Weaknesses Of C Strengths Weaknesses Effective Use of C 2. C Fundamentals

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

This code has a bug that allows a hacker to take control of its execution and run evilfunc().

This code has a bug that allows a hacker to take control of its execution and run evilfunc(). Malicious Code Insertion Example This code has a bug that allows a hacker to take control of its execution and run evilfunc(). #include // obviously it is compiler dependent // but on my system

More information

Computer programming UNIT IV UNIT IV. GPCET,Dept of CSE, P Kiran Rao

Computer programming UNIT IV UNIT IV. GPCET,Dept of CSE, P Kiran Rao UNIT IV COMMAND LINE ARGUMENTS Computer programming UNIT IV It is possible to pass some values from the command line to C programs when they are executed. These values are called command line arguments

More information

Object Oriented Pragramming (22316)

Object Oriented Pragramming (22316) Chapter 1 Principles of Object Oriented Programming (14 Marks) Q1. Give Characteristics of object oriented programming? Or Give features of object oriented programming? Ans: 1. Emphasis (focus) is on data

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

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

Pointers and File Handling

Pointers and File Handling 1 Pointers and File Handling From variables to their addresses Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 2 Basics of Pointers INDIAN INSTITUTE OF TECHNOLOGY

More information

19-Nov CSCI 2132 Software Development Lecture 29: Linked Lists. Faculty of Computer Science, Dalhousie University Heap (Free Store)

19-Nov CSCI 2132 Software Development Lecture 29: Linked Lists. Faculty of Computer Science, Dalhousie University Heap (Free Store) Lecture 29 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 29: Linked Lists 19-Nov-2018 Location: Chemistry 125 Time: 12:35 13:25 Instructor: Vlado Keselj Previous

More information

PDS Class Test 2. Room Sections No of students

PDS Class Test 2. Room Sections No of students PDS Class Test 2 Date: October 27, 2016 Time: 7pm to 8pm Marks: 20 (Weightage 50%) Room Sections No of students V1 Section 8 (All) Section 9 (AE,AG,BT,CE, CH,CS,CY,EC,EE,EX) V2 Section 9 (Rest, if not

More information

Procedural Programming

Procedural Programming Exercise 5 (SS 2016) 28.06.2016 What will I learn in the 5. exercise Strings (and a little bit about pointer) String functions in strings.h Files Exercise(s) 1 Home exercise 4 (3 points) Write a program

More information

Dynamic memory allocation

Dynamic memory allocation Dynamic memory allocation outline Memory allocation functions Array allocation Matrix allocation Examples Memory allocation functions (#include ) malloc() Allocates a specified number of bytes

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

Jagannath Institute of Management Sciences Lajpat Nagar. BCA II Sem. C Programming

Jagannath Institute of Management Sciences Lajpat Nagar. BCA II Sem. C Programming Jagannath Institute of Management Sciences Lajpat Nagar BCA II Sem C Programming UNIT I Pointers: Introduction to Pointers, Pointer Notation,Decalaration and Initialization, Accessing variable through

More information

Dynamic Memory. Dynamic Memory Allocation Strings. September 18, 2017 Hassan Khosravi / Geoffrey Tien 1

Dynamic Memory. Dynamic Memory Allocation Strings. September 18, 2017 Hassan Khosravi / Geoffrey Tien 1 Dynamic Memory Dynamic Memory Allocation Strings September 18, 2017 Hassan Khosravi / Geoffrey Tien 1 Pointer arithmetic If we know the address of the first element of an array, we can compute the addresses

More information

MODULE 1. Introduction to Data Structures

MODULE 1. Introduction to Data Structures MODULE 1 Introduction to Data Structures Data Structure is a way of collecting and organizing data in such a way that we can perform operations on these data in an effective way. Data Structures is about

More information

Procedural Programming & Fundamentals of Programming

Procedural Programming & Fundamentals of Programming & Fundamentals of Programming Exercise 4 (SS 2018) 12.06.2018 What will I learn in the 5. exercise Files Math functions Dynamic data structures (linked Lists) Exercise(s) 1 Files A file can be seen as

More information

Arrays and Pointers (part 1)

Arrays and Pointers (part 1) Arrays and Pointers (part 1) CSE 2031 Fall 2010 17 October 2010 1 Arrays Grouping of data of the same type. Loops commonly used for manipulation. Programmers set array sizes explicitly. 2 1 Arrays: Example

More information

Arrays, Strings, & Pointers

Arrays, Strings, & Pointers Arrays, Strings, & Pointers Alexander Nelson August 31, 2018 University of Arkansas - Department of Computer Science and Computer Engineering Arrays, Strings, & Pointers Arrays, Strings, & Pointers are

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 9 Pointer Department of Computer Engineering 1/46 Outline Defining and using Pointers

More information

Lectures 5-6: Introduction to C

Lectures 5-6: Introduction to C Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most

More information

Lecture07: Strings, Variable Scope, Memory Model 4/8/2013

Lecture07: Strings, Variable Scope, Memory Model 4/8/2013 Lecture07: Strings, Variable Scope, Memory Model 4/8/2013 Slides modified from Yin Lou, Cornell CS2022: Introduction to C 1 Outline Review pointers New: Strings New: Variable Scope (global vs. local variables)

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

Variation of Pointers

Variation of Pointers Variation of Pointers A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before

More information

Pointers, Arrays, and Strings. CS449 Spring 2016

Pointers, Arrays, and Strings. CS449 Spring 2016 Pointers, Arrays, and Strings CS449 Spring 2016 Pointers Pointers are important. Pointers are fun! Pointers Every variable in your program has a memory location. This location can be accessed using & operator.

More information

CSC209H Lecture 3. Dan Zingaro. January 21, 2015

CSC209H Lecture 3. Dan Zingaro. January 21, 2015 CSC209H Lecture 3 Dan Zingaro January 21, 2015 Streams (King 22.1) Stream: source of input or destination for output We access a stream through a file pointer (FILE *) Three streams are available without

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

C: Pointers, Arrays, and strings. Department of Computer Science College of Engineering Boise State University. August 25, /36

C: Pointers, Arrays, and strings. Department of Computer Science College of Engineering Boise State University. August 25, /36 Department of Computer Science College of Engineering Boise State University August 25, 2017 1/36 Pointers and Arrays A pointer is a variable that stores the address of another variable. Pointers are similar

More information

What is recursion. WAP to find sum of n natural numbers using recursion (5)

What is recursion. WAP to find sum of n natural numbers using recursion (5) DEC 2014 Q1 a What is recursion. WAP to find sum of n natural numbers using recursion (5) Recursion is a phenomenon in which a function calls itself. A function which calls itself is called recursive function.

More information

C Syntax Arrays and Loops Math Strings Structures Pointers File I/O. Final Review CS Prof. Jonathan Ventura. Prof. Jonathan Ventura Final Review

C Syntax Arrays and Loops Math Strings Structures Pointers File I/O. Final Review CS Prof. Jonathan Ventura. Prof. Jonathan Ventura Final Review CS 2060 Variables Variables are statically typed. Variables must be defined before they are used. You only specify the type name when you define the variable. int a, b, c; float d, e, f; char letter; //

More information

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 17 EXAMINATION Subject Name: Data Structure Using C Model Answer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as

More information

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

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \ BSc IT C Programming (2013-2017) Unit I Q1. What do you understand by type conversion? (2013) Q2. Why we need different data types? (2013) Q3 What is the output of the following (2013) main() Printf( %d,

More information

Computers Programming Course 11. Iulian Năstac

Computers Programming Course 11. Iulian Năstac Computers Programming Course 11 Iulian Năstac Recap from previous course Cap. Matrices (Arrays) Matrix representation is a method used by a computer language to store matrices of different dimension in

More information

ENEE150 Final Exam Review

ENEE150 Final Exam Review ENEE150 Final Exam Review Topics: Pointers -- pointer definitions & initialization -- call-by-reference and Call-by-value -- pointer with arrays -- NULL pointer, void pointer, and pointer to pointer Strings

More information

File I/O. Arash Rafiey. November 7, 2017

File I/O. Arash Rafiey. November 7, 2017 November 7, 2017 Files File is a place on disk where a group of related data is stored. Files File is a place on disk where a group of related data is stored. C provides various functions to handle files

More information

Fundamentals of Programming & Procedural Programming

Fundamentals of Programming & Procedural Programming Universität Duisburg-Essen PRACTICAL TRAINING TO THE LECTURE Fundamentals of Programming & Procedural Programming Session Seven: Strings and Files Name: First Name: Tutor: Matriculation-Number: Group-Number:

More information

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters,

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, Strings Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, decimal digits, special characters and escape

More information

SAE1A Programming in C. Unit : I - V

SAE1A Programming in C. Unit : I - V SAE1A Programming in C Unit : I - V Unit I - Overview Character set Identifier Keywords Data Types Variables Constants Operators SAE1A - Programming in C 2 Character set of C Character set is a set of

More information

Chapter 14. Dynamic Data Structures. Instructor: Öğr. Gör. Okan Vardarlı. Copyright 2004 Pearson Addison-Wesley. All rights reserved.

Chapter 14. Dynamic Data Structures. Instructor: Öğr. Gör. Okan Vardarlı. Copyright 2004 Pearson Addison-Wesley. All rights reserved. Chapter 14 Dynamic Data Structures Instructor: Öğr. Gör. Okan Vardarlı Copyright 2004 Pearson Addison-Wesley. All rights reserved. 12-1 Dynamic Data Structure Usually, so far, the arrays and strings we

More information

mith College Computer Science CSC270 Spring 2016 Circuits and Systems Lecture Notes, Week 11 Dominique Thiébaut

mith College Computer Science CSC270 Spring 2016 Circuits and Systems Lecture Notes, Week 11 Dominique Thiébaut mith College Computer Science CSC270 Spring 2016 Circuits and Systems Lecture Notes, Week 11 Dominique Thiébaut dthiebaut@smithedu Outline A Few Words about HW 8 Finish the Input Port Lab! Revisiting Homework

More information

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef today advanced data types (1) typedef. mon 23 sep 2002 homework #1 due today homework #2 out today quiz #1 next class 30-45 minutes long one page of notes topics: C advanced data types dynamic memory allocation

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

Lectures 5-6: Introduction to C

Lectures 5-6: Introduction to C Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most

More information

Guide for The C Programming Language Chapter 4

Guide for The C Programming Language Chapter 4 1. What is Structure? Explain the syntax of Structure declaration and initialization with example. A structure is a collection of one or more variables, possibly of different types, grouped together under

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

Procedural Programming & Fundamentals of Programming

Procedural Programming & Fundamentals of Programming Procedural Programming & Fundamentals of Programming Exercise 3 (SS 2018) 29.05.2018 What will I learn in the 4. exercise Pointer (and a little bit about memory allocation) Structure Strings and String

More information

DS Assignment II. Full Sized Image

DS Assignment II. Full Sized Image DS Assignment II 1. A) For the Towers of Hanoi problem, show the call tree during the recursive call Towers(3, A, C, B). In the tree, label the root node as Towers (3, A, C, B) while marking all the intermediate

More information

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam-613 403 Thanjavur 01. Define program? 02. What is program development cycle? 03. What is a programming language? 04. Define algorithm? 05. What

More information

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes

More information

Programming. Pointers, Multi-dimensional Arrays and Memory Management

Programming. Pointers, Multi-dimensional Arrays and Memory Management Programming Pointers, Multi-dimensional Arrays and Memory Management Summary } Computer Memory } Pointers } Declaration, assignment, arithmetic and operators } Casting and printing pointers } Relationship

More information

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ.

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ. C BOOTCAMP DAY 2 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Pointers 2 Pointers Pointers are an address in memory Includes variable addresses,

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

7/21/ FILE INPUT / OUTPUT. Dong-Chul Kim BioMeCIS UTA

7/21/ FILE INPUT / OUTPUT. Dong-Chul Kim BioMeCIS UTA 7/21/2014 1 FILE INPUT / OUTPUT Dong-Chul Kim BioMeCIS CSE @ UTA What s a file? A named section of storage, usually on a disk In C, a file is a continuous sequence of bytes Examples for the demand of a

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS 1. Define global declaration? The variables that are used in more

More information

Chapter 8: Character & String. In this chapter, you ll learn about;

Chapter 8: Character & String. In this chapter, you ll learn about; Chapter 8: Character & String Principles of Programming In this chapter, you ll learn about; Fundamentals of Strings and Characters The difference between an integer digit and a character digit Character

More information

Solution for Data Structure

Solution for Data Structure Solution for Data Structure May 2016 INDEX Q1 a 2-3 b 4 c. 4-6 d 7 Q2- a 8-12 b 12-14 Q3 a 15-18 b 18-22 Q4- a 22-35 B..N.A Q5 a 36-38 b N.A Q6- a 39-42 b 43 1 www.brainheaters.in Q1) Ans: (a) Define ADT

More information

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

Language comparison. C has pointers. Java has references. C++ has pointers and references Pointers CSE 2451 Language comparison C has pointers Java has references C++ has pointers and references Pointers Values of variables are stored in memory, at a particular location A location is identified

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

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

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information