CS PROGRAMMING & DATA STRUCTURES. UNIT I Part - A. 2. What is the difference between if and while statement?

Size: px
Start display at page:

Download "CS PROGRAMMING & DATA STRUCTURES. UNIT I Part - A. 2. What is the difference between if and while statement?"

Transcription

1 CS PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1. What are Keywords? Keywords are certain reserved words that have standard and pre-defined meaning in C. These keywords can be used only for their intended purpose. Example: float, int,break, continue, goto, if, if- else, while, do-while,.. etc 2. What is the difference between if and while statement? if (i) It is a conditional statement (ii) If the condition is true, it executes some statements. (iii) If the condition is false then it stops the execution the statements. while (i) It is a loop control statement (ii) Executes the statements within the while block if the condition is true. (iii) If the condition is false the control is transferred to the next statement of the loop. 3. What is the difference between while loop and do while loop? In the while loop the condition is first executed. If the condition is true then it executes the body of the loop. When the condition is false it comes of the loop. In the do while loop first the statement is executed and then the condition is checked. The do while loop will execute at least one time even though the condition is false at the very first time. 4. What will happen when you access the array more than its dimension? When you access the array more than its dimensions some garbage value is stored in the array. 5. Write the limitations of getchar( ) and sacnf( ) functions for reading strings getchar( ) To read a single character from stdin, then getchar() is the appropriate. Scanf() scanf( ) allows to read more than just a single character at a time. Page 1

2 6. What is the output of the programs given below? main() main() float a; float a; int x=6, y=4; int x=6, y=4; a=x\y; a=(float) x\y; printf( Value of a=%f, a); printf( Value of a=%f,a); } } Output: Output: Distinguish between Call by value Call by reference. Call by value Call by reference. a) In call by value, the value of a) In call by reference, the address of actual actual argurment values is passed agreements is passed to the to formal argument values. formal arguments and the b) Formal arguments values are operation is done on formal pointers to the actual argument arguments. values. b) Formal arguments values c) Since Address is passed, the are photocopies of actual changes made in the both arguments values. arguments values are permanent. c) Changes made in formal arguments valued do not affect the actual arguments values. 8. What is the difference between while(a) and while(!a)? while(a) means while(a!=0) while(!a) means while(a==0) Page 2

3 9. Why we don t use the symbol & symbol, while reading a String through scanf()? The & is not used in scanf() while reading string, because the character variable itself specifies as a base address. Example: name, &name[0] both the declarations are same. 10. What is the difference between static and auto storage classes? Static Auto Storage Memory Memory Initial value Zero Garbage value Scope Local to the block in which Local to the block in which the variables is defined the variable is defined. Life Value of the variable persists The block in which the between different variable is defined. function calls. 11. What is the output of the program? main() increment() increment(); static int i=1; increment(); printf( %d\n,i) increment(); i=i+1; } } OUTPUT: Define delimiters in C. Delimiters Use : Colon Useful for label ; Semicolon Terminates Statement ( ) Parenthesis Used in expression and functions [ ] Square Bracket Used for array declaration } Curly Brace Scope of statement # Hash Preprocessor directive, Comma Variable Separator Page 3

4 13. Differentiate break and continue statement. S No break continue 1 Exits from current block / loop Loop takes next iteration 2 Control passes to next statement Control passes to beginning of loop 3 Terminates the program Never terminates the program 14. List the types of operators. S No Operators Types Symbolic Representation 1 Arithmetic operators =, -, *, / and % 2 Relational operators >,<, ==, >=, <= and!= 3 Logical operators &&, and! 4 Increment and Decrement ++ and 5 operators =, + =, - =, * =, / =, ^ =, ; =, & = 6 Assignment &,, ^, >>, <<, and ~ 7 operators Bitwise, 8 operators Comma? : operator Conditional

5 15. Distinguish between while..do and do..while statement in C. While DO..while (i) Executes the statements within the (i) Executes the statements within the while block if only the condition is true. while block at least once. (ii) The condition is checked at the starting of the loop (ii) The condition is checked at the end of the loop 16. Compare switch( ) and nestedif statement. S No switch( ) case nested if 1 Test for equality ie., only constant It can equate relational (or) values are applicable. logical expressions. 2 No two case statements in Same conditions may be repeated 3 same switch. for a number of times. Character constants are Character constants are automatically converted to 4 automatically converted to integers. integers. In nested if statement switch case In switch( ) case statement can be used. nested if can be used. 17. Give the syntax for the for loop statement for (Initialize counter; Test condition; Increment / Decrement) statements; } Initialization counter sets the loop to an initial value. This statement isexecuted only once. The test condition is a relational expression that determines the number of iterations desired or it determines when to exit from the loop. The increment / decrement parameter decides how to make changes in the loop. Page 5

6 18. What is the use of sizeof( ) operator? The sizeof ( ) operator gives the bytes occupied by a variable. No of bytes occupied varies from variable to variable depending upon its data types. Example: intx,y; printf( %d,sizeof(x)); Output: What is a loop control statement? Many tasks done with the help of a computer are repetitive in nature. Such tasks can be done with loop control statements. 20. What are global variable in C? This section declares some variables that are used in more than one function. such variable are called as global variables. It should be declared outside all functions. 21. Write a program to swap the values of two variables (without temporary variable). #include <stdio.h> #include <conio.h> void main( ) int a =5; b = 10; clrscr( ); prinf( Before swapping a = %d b = %d, a, b); a = a + b; b = a b; a = a b; prinf( After swapping a = %d b = %d, a,b); getch( ); } Output: Before swapping a = 5 b = 10 After swapping a = 10 b = What is an array? Page 6

7 An array is a group of similar data types grouped under a common name. int a[10]; Here a[10] is an array with 10 values. 23. What is a Pointer? How a variable is declared to the pointer? Pointer is a variable which holds the address of another variable. Pointer Declaration: datatype *variable-name; Example: int *x, c=5; x=&a; 24. What are the uses of Pointers? Pointers are used to return more than one value to the function Pointers are more efficient in handling the data in arrays Pointers reduce the length and complexity of the program They increase the execution speed The pointers saves data storage space in memory 25. What is the output of the program? main() junk(int i, int j) int i=5;j=2; i=i*j; junk(i,j); j=i*j; printf( \n %d %d,i,j); } } Output: What are * and & operators means? * operator means value at the address & operator means address of 27. What is meant by Preprocessor? Preprocessor is the program, that process our source program before the compilation. Page 7

8 28. How can you return more than one value from a function? value. A Function returns only one value. By using pointer we can return more than one 29. What are the main elements of an array declaration? Array name - Datatype - Size 30. List the header files in C language. <stdio.h>contains standard I/O functions<ctype.h>contains character handling functions<stdlib.h>contains general utility functions<string.h>contains string manipulation functions<math.h>contains mathematical functions<time.h>contains time manipulation functions 31. What are the pre-processor directives? Macro Inclusion Conditional Inclusion File Inclusion. 32. What is the difference between an array and pointer? Difference between arrays and pointers are as follows. Array Pointer 1.Array allocates space 1.Pointer is explicitly assigned to point to automatically. an allocated space. 2.It cannot be resized. 2.It can be resized using realloc (). 3.It cannot be reassigned. 3.Pointers can be reassigned. 4.Size of(array name) gives the 4.Sezeof(pointer name) returns the number of bytes occupied by number of bytes used to store the pointer the array. variable. Page 8

9 33.Is it better to use a macro or a function? Macros are more efficient (and faster) than function, because their corresponding code is inserted directly at the point where the macro is called. There is no overhead involved in using a macro like there is in placing a call to a function. However, macros are generally small and cannot handle large, complex coding constructs. In cases where large, complex constructs are to handled, functions are more suited, additionally; macros are expanded inline, which means that the code is replicated for each occurrence of a macro. 34. List the characteristics of Arrays. ƒ All elements of an array share the same name, and they are distinguished form one another with help of an element number. ƒ Any particular element of an array can be modified separately without disturbing other elements. 35.What are the types of Arrays? 1.One-Dimensional Array 2. Two-Dimensional Array 3. Multi-Dimensional Array 36. What is the use of \0 character? When declaring character arrays (strings), \0 (NULL) character is automatically added at end. The \0 character acts as an end of character array. 37. What is C functions? Why they are used? A function is a self-contained block (or) a sub-program of one or more statements that performs a special task when called. To perform a task repetitively then it is not necessary to re-write the particular block of the program again and again. The function defined can be used for any number of times to perform the task. 38. Differentiate library functions and User-defined functions. Library Functions User-defined Functions Page 9

10 a) Library functions are predefined set of functions that are defined in C libraries. b) User can only use the function but cannot change a) The User-defined functions are the functions defined by the user according to his/her requirement. b) User can use this type of function. User can also modify this function. 39. What are the steps in writing a function in a program. a) Function Declaration (Prototype declaration): Every user-defined functions has to be declared before the main b) Function Callings: The user-defined functions can be called inside any functions like main(), user-defined function, etc. c) Function Definition: The function definition block is used to define the user-defined functions with statements. 40. Give the syntax for using user-defined functions in a program. Syntax for using user-defined functions in a program Syntax: function declaration; function main() definition; ====== ====== function calling; (or) function calling; ====== ====== } } function definition; 41. Classify the functions based on arguments and return values. Depending on the arguments and return values, functions are classified into four types. a) Function without arguments and return values. b) Function with arguments but without return values. c) Function without arguments but with return values. d) Function with arguments and return values. Page 10

11 42. Define pre-processor in C. The C Preprocessor is not part of the compiler, but is a separate step in the compilation process. In simplistic terms, a C Preprocessor is just a text substitution tool. We'll refer to the C Preprocessor as the CPP. Example: #define Substitutes a preprocessor macro #include Inserts a particular header from another file 43. Define Macro in C. A macro definition is independent of block structure, and is in effect from the #define directive that defines it until either a corresponding #undef directive or the end of the compilation unit is encountered. Its format is: #define identifier replacement Example: #define TABLE_SIZE 100 inttable1[table_size]; int table2[table_size]; 44. What are conditional Inclusions in Preprocessor Directive? Conditional inclusions (#ifdef, #ifndef, #if, #endif, #else and #elif) These directives allow including or discarding part of the code of a program if a certain condition is met. #ifdef allows a section of a program to be compiled only if the macro that is specified as the parameter has been defined, no matter which its value is. For example: #ifdef TABLE_SIZE int table[table_size]; #endif 45. What you meant by Source file Inclusion in Preprocessor directive? Source file inclusion (#include) Page 11

12 This directive has also been used assiduously in other sections of this tutorial. When the preprocessor finds an #include directive it replaces it by the entire content of the specified file. There are two ways to specify a file to be included: 1 #include "file" 2 #include <file> PART B 1. Explain about the various decision making statements in C language. 2. Explain the control statements in c. 3. What are functions? Explain the types of functions in detail with an example program for each type. 4. Define arrays. Explain the array types with an example program for each type 5. What are pointers? When and why they are used? Explain in detail with sample programs. 6. Describe in detail about the Preprocessors in C. 7. Explain function pointers with example. 8. Detailly explain about function with variable number of arguments.? Page 12

13 1. Define structure. CS PROGRAMMING & DATA STRUCTURES I UNIT II Part A A structure is a user defined data type that groups logically related data items of different data types into a single unit. All the elements of a structure are stored at contiguous memory locations. 2. What is meant by structure template? A structure template contains definition of a structure name and a list of members along with data types. 3. Write the syntax for structure declaration and definition Structure definition: structstructure_name Datatype member1; Datatype member2; }; Structure declaration: structstructure_name v1,v2, ; 4. Define union. A union is a user defined data type similar to structure. The union groups logically related data items of different data types into a single unit. But the memory allocation for union is different from structure. 5. Write the syntax for union declaration and definition. Union definition: unionunion_name Datatype member1; Datatype member2; }; Union declaration: unionunion _name v1,v2, ; 6. How structures are initialized? Give example. Page 1

14 o A structure can be initialized in two ways. struct student intrno; int age; char name[20]; }; x Structure variable initialization o struct student s1=223,17, john }; x Structure member by member initialization o s1.rno=223; o s1.age=17; o s1.name= john ; 7. What are nested structures? A structure built within another structure is called nested structures or structure within a structure. Example: struct dob int day; int month; int year; }; struct student intrno; char name[20]; }; struct dob date; 8. What is meant by array of structures? An array of structure contains data elements of every structure variable stored into an array. Example: struct student intrno; int age; Page 2

15 char name[20]; }s[15]; 9. What is structure assignment? The value of one structure variable is assigned to another variable of same type using assignment statement. If the e1 and e2 are structure variables of type employee then the structure assignment can be performed as e1=e2; This assigns value of structure variable e2 to e How do you reference a structure member? The structure members cannot be accessed directly. They can be accessed by using the name of the structure variable followed by a dot(.) and then the name of the member variable. struct student intrno; int age; char name[20]; }s1; s1.rno=223; s1.age=17; s1.name= john ; 11. Differentiate structure and union. S.No. Structure Union 1. A structure is defined with struct A union is defined with union keyword keyword 2. All members of a structure can be The members of a union can be utilized utilized simultaneously. only one at a time. 3. The size of a structure variable is equal The size of the union variable is equal to the sum of the size of the members to the size of the largest member. 4. Structure members are allocated Union members share common distinct memory locations memory space. 5. Structures are not memory efficient Unions are memory efficient. when compared to unions. 12. Differentiate structure and arrays. S.No. Structure Array 1. Definition and declaration of program Definition and declaration of program in structures are different. in arrays are same.

16 2. A structure is a group of dissimilar data An array is a group of similar data 3. Nested structures is possible No nested arrays 4. Structure members are accessed with Index is used to access data in arrays. dot (.) operator. 5. In structures, reserved word struct is In arrays, no reserved word is used. used. 13. What are the advantages of union over structure? x Union save memory space compared to structures since the size of union is equal to its largest sized member. x Unions are useful in situations where there is a need to use only one of its member elements at a time 14. Write the syntax for pointers to structure. structstructure_name Datatype member1; Datatype member2; }s1; structstructure_name *ptr; ptr=&s1; 15. What is a file? A file is a collection of data that is available in permanent storage. 16. Write the syntax for file declaration. Syntax: FILE *filepointer; Example: FILE *fp; 17. What are file modes? Modes tell about the type of operation to be performed on a file that is being opened. There are three basic file modes: a. Read b. Write c. Append 18. Write the syntax to open a file. Syntax: Page 4

17 FILE *filepointer; filepointer = fopen( filename, mode ); Example: FILE *fp; fp=fopen( hai.txt, r ); 19. What is the significance of fclose() function? This function closes a file that has been opened for an operation. Syntax: fclose(filepointer); 20. What are the steps for using a file? The basic steps for using a file in C are as follows: a. Create a variable of type FILE * ; b. Open the file using fopen function and assign the file to the variable. c. Check to make sure that the file was successfully opened by checking to see if the variable is equal to NULL. d. Perform file operations like read,write, 21. What are the functions of text files in stdio library? a. fopen() opens a file. b. fclose() closes a file. c. feof() - detects end-of-file marker in a file. d. fscanf() reads formatted input from a file. e. fprintf() writes formatted output to a file. f. fgets() reads a string from a file g. fputs() writes a string to a file h. fgets() reads a character from a file i. fputs() writes a character to a file 22. What are the file pointers of stdlib.h? There are three special file pointers. 1. stdin (Standard input) 2. stdout (Standard output) 3. stderr (Standard error) 23. What are the types of files? There are two types a. Text file b. Binary file Page 5

18 If a large amount of numerical data is to be stored, text files will be insufficient. In such cases, binary files can be used. 24. What are the features of binary files? x Any structure can be used in the file. x Contents can be changed anywhere in the file. 25. What are the functions to access files randomly? There are three functions to perform random access. x ftell() tells the current position of a file x fseek() moves to a desired location from the current position x rewind() resets the file position to the beginning of a file. Part B 1. Explain the different modes in which a file can be opened. 2. Explain the functions fscanf, fprintf, fgets, fputs, getw, putw, getc, putc, fread, fwrite, feof, ferror,fseek,ftell,rewind with example. 3. Explain structures with an example 4. Explain union with an example 5. Discuss about the file handling concepts in C 6. Explain different ways to read data from a file. 7. Explain different ways to write data to a file 8. Design a c program to create the employee database and to perform the manipulations such as adding a record, deleting a record, updating a record. 9. Explain about structure within structure with example. Page 6

19 CS PROGRAMMING & DATA STRUCTURES - I 1. What is a data structure? Unit III Part A A data structure is a method for organizing and storing data which would allow efficient data retrieval and usage. A data structure is a way of organizing data that considers not only the items stored, but also their relationships to each other. 2. Why do we need data structures? x Data structures allow us to achieve an important goal: component reuse. x Once data structure has been implemented, it can be used again and again in various applications. 3. List some common data structures. x Stacks x Queues x Lists x Trees x Graphs x Tables 4. How data structures are classified? Data structures are classified into two categories based on how the data items are operated: i. Primitive data structure ii. Non-Primitive data structure a. Linear data structure b. Non-linear data structure 5. Differentiate linear and non-linear data structure. S.No Linear data structure Non-linear data structure 1 Data are arranged in linear or Data are not arranged in linear manner. sequential manner 2 Every items is related to its previous Every item is attached with many other and next item items 3 Data items can be traversed in a Data items cannot be traversed in a single run. single run. 4 Implementation is easy Implementation is difficult. Page 1

20 5 Example: array, stack, queue, linked Example: tree, graph list 6. Define ADT(Abstract Data Type) An abstract data type (ADT) is a set of operations and mathematical abstractions, which can be viewed as how the set of operations is implemented. Objects like lists, sets and graphs, along with their operation, can be viewed as abstract data types, just as integers, real numbers and Booleans. 7. Mention the features of ADT. a. Modularity i. Divide program into small functions ii. Easy to debug and maintain iii. Easy to modify b. Reuse i. Define some operations only once and reuse them in future c. Easy to change the implementation 8. Define List ADT A list is a sequence of zero or more elements of a given type. The list is represented as sequence of elements separated by comma. A1,A2,A3..AN Where N>0 and A is of type element. 9. What are the ways of implementing linked list? The list can be implemented in the following ways: i. Array implementation ii. Linked-list implementation iii. Cursor implementation 10. What are the types of linked lists? There are three types i. Singly linked list ii. Doubly linked list iii. Circularly linked list

21 11. How the singly linked lists can be represented? 0Head Node Null

22 Each node has two elements i. Data ii. Next 12. How the doubly linked list can be represented? Head Doubly linked list is a collection of nodes where nodes are connected by forwarded and backward link. Each node has three fields: 1. Address of previous node 2. Data 3. Address of next node. 13. What are benefits of ADT? a. Code is easier to understand b. Implementation of ADT can be changed without requiring changes to the program that uses the ADT 14. When singly linked list can be represented as circular linked list? In a singly linked list, all the nodes are connected with forward links to the next nodes in the list. The last node has a next field, NULL. In order to implement the circularly linked lists from singly linked lists, the last node s next field is connected to the first node 15. When doubly linked list can be represented as circular linked list? In a doubly linked list, all nodes are connected with forward and backward links to the next and previous nodes respectively. In order to implement circular linked lists from doubly linked lists, the first node s previous field is connected to the last node and the last node s next field is connected to the first node. Page 3

23 16. Where cursor implementation can be used? The cursor implementation of lists is used by many languages such as BASIC and FORTRAN that do not support pointers. The two important features of the cursor implementation of linked are as follows: x The data are stored in a collection of structures. Each structure contains data and a index to the next structure. x A new structure can be obtained from the system s global memory by a call to cursorspace array. 17. List down the applications of List. a. Representation of polynomial ADT b. Used in radix and bubble sorting c. In a FAT file system, the metadata of a large file is organized as a linked list of FAT entries. d. Simple memory allocators use a free list of unused memory regions, basically a linked list with the list pointer inside the free memory itself. 18. What are the advantages of linked list? a. Save memory space and easy to maintain b. It is possible to retrieve the element at a particular index c. It is possible to traverse the list in the order of increasing index. d. It is possible to change the element at a particular index to a different value, without affecting any other elements. 19. Mention the demerits of linked list a. It is not possible to go backwards through the list b. Unable to jump to the beginning of list from the end. 20. How the polynomial is represented using linked lists? The polynomial equation can be represented with linked list as follows: Coefficient Exponent Next node link struct polynomial int coefficient; int exponent; struct polynomial *next; }; Page 4

24 21. What are the operations performed in list? The following operations can be performed on a list i. Insertion a. Insert at beginning b. Insert at end c. Insert after specific node d. Insert before specific node ii. Deletion a. Delete at beginning b. Delete at end c. Delete after specific node d. Delete before specific node iii. Merging iv. Traversal 22. What are the merits and demerits of array implementation of lists? Merits x Fast, random access of elements x Memory efficient very less amount of memory is required Demerits x Insertion and deletion operations are very slow since the elements should be moved. x Redundant memory space difficult to estimate the size of array. 23. What is a circular linked list? A circular linked list is a special type of linked list that supports traversing from the end of the list to the beginning by making the last node point back to the head of the list. Part B 1. Explain the various operations of the list ADT with examples 2. Write the program for array implementation of lists 3. Write a C program for linked list implementation of list. 4. Explain the operations of singly linked lists 5. Explain the operations of doubly linked lists 6. Explain the operations of circularly linked lists 7. How polynomial manipulations are performed with lists? Explain the operations 8. Explain the steps involved in insertion and deletion into an singly and doubly linked list. Page 5

25 1. Define Stack. CS PROGRAMMING & DATA STRUCTURES I Unit IV Part - A A stack is an ordered list in which all insertions and deletions are made at one end, called the top. It is an abstract data type and based on the principle of LIFO (Last In First Out). 2. What are the operations of the stack? a. CreateStack/ InitStack(Stack) creates an empty stack b. Push(Item) pushes an item on the top of the stack c. Pop(Item) removes the top most element from the stack d. Top(Stack) returns the first element from the stack e. IsEmpty(Stack) returns true if the stack is empty 3. Write the routine to push a element into a stack. Push(Element X, Stack S) if(isfull(s) Error( Full Stack ); } else S Array[++S TopOfStack]=X; } 4. How the operations performed on linked list implementation of stack? a. Push and pop operations at the head of the list b. New nodes should be inserted at the front of the list, so that they become the top of the stack c. Nodes are removed from the front(top) of the stack 5. What are the applications of stack? The following are the applications of stacks Evaluating arithmetic expressions Balancing the parenthesis Towers of Hanoi Function calls Tree traversal Page 1

26 6. What are the methods to implement stack in C? The methods to implement stacks are : x Array based x Linked list based 7. How the stack is implemented by linked list? It involves dynamically allocating memory space at run time while performing stack operations. Since it consumes only that much amount of space is required for holding its data elements, it prevents wastage of memory space. struct stack int element; struct }*top; stack *next; 8. Write the routine to pop a element from a stack. int pop() if(top==null) printf( \n Stack is empty.\n ); getch(); exit(1); } else int temp; temp=top element; /* retreiving the top element*/ top=top next; /* Updating the stack pointer */ return temp; /* returning the popped value */ } } 9. Define queue. It is a linear data structure that maintains a list of elements such that insertion happens at rear end and deletion happens at front end. FIFO First In First Out principle Page 2

27 10. What are the operations of a queue? The operations of a queue are x isempty() x isfull() x insert() x delete() x display() 11. Write the routine to insert a element onto a queue. void insert(int element) } if(front==-1 ) front = rear = front +1; queue[front] = element; return; } if(rear==99) printf( Queue is full ); getch(); return; } rear = rear +1; queue[rear]=element; 12. What are the types of queue? The following are the types of queue: x Double ended queue x Circular queue x Priority queue Page 3

28 13. Define double ended queue x It is a special type of queue that allows insertion and deletion of elements at both ends x It is also termed as DEQUE. 14. What are the methods to implement queue in C? The methods to implement queues are : x Array based x Linked list based 15. How the queue is implemented by linked list? It is based on the dynamic memory management techniques which allow allocation and de-allocation of memory space at runtime. Insert operation It involves the following subtasks: x Reserving memory space of the size of a queue element in memory x Storing the added value at the new location x Linking the new element with existing queue x Updating the rear pointer Delete operation It involves the following subtasks: 1. Checking whether queue is empty 2. Retrieving the front most element of the queue 3. Updating the front pointer 4. Returning the retrieved value 16. Write the routine to delete a element from a queue intdel() int i; if(front == NULL) /*checking whether the queue is empty*/ return(-9999); } else Page 4

29 } } i = front element; front = front next; return i; 17. What are the applications of queue? The following are the areas in which queues are applicable a. Simulation b. Batch processing in an operating systems c. Multiprogramming platform systems d. Queuing theory e. Printer server routines f. Scheduling algorithms like disk scheduling, CPU scheduling g. I/O buffer requests 18. Define circular queue A Circular queue is a queue whose start and end locations are logically connected with each other. That means the start location comes after the end location. 19. What are push and pop operations? Push adding an element to the top of stack Pop removing or deleting an element from the top of stack 20. What are enqueue and dequeue operations? Enqueue - adding an element to the queue at the rear end Dequeue removing or deleting an element from the queue at the front end Page 5

30 Part B 1. Explain Stack ADT and its operations 2. Explain array based implementation of stacks 3. Explain linked list implementation of stacks 4. Explain the applications of Stacks 5. Explain how to evaluate arithmetic expressions using stacks 6. Explain queue ADT 7. Explain array based implementation of queues 8. Explain linked list implementation of queues 9. Explain the applications of queues 10. Explain circular queue and its implementation 11. Explain double ended queue and its operations Page 6

31 CS PROGRAMMING & DATA STRUCTURES I Unit V Part A 1. Define sorting Sorting arranges the numerical and alphabetical data present in a list in a specific order orsequence. There are a number of sorting techniques available. The algorithms can be chosen based on the following factors Size of the data structure Algorithm efficiency Programmer s knowledge of the technique. 2. Mention the types of sorting x Internal sorting x External sorting 3. What do you mean by internal and external sorting? An internal sort is any data sorting process that takes place entirely within the main memory of a computer. This is possible whenever the data to be sorted is small enough to all be held in the main memory. External sorting is a term for a class of sorting algorithms that can handle massiveamounts of data. External sorting is required when the data being sorted do not fit into the main memory of a computing device (usually RAM) and instead they must reside in the slower external memory (usually a hard drive) 4. Define bubble sort Bubble sort is a simplesorting algorithmthat works by repeatedly stepping through thelist to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements "bubble" to the top of the list. 5. How the insertion sort is done with the array? It sorts a list of elements by inserting each successive element in the previously sorted sublist. Consider an array to be sorted A[1],A[2],.A[n] a. Pass 1 : A[2] is compared with A[1] and placed them in sorted order. b. Pass 2 : A[3] is compared with both A[1] and A[2] and inserted at an appropriate place. This makes A[1], A[2],A[3] as a sorted sub array. c. Pass n-1 : A[n] is compared with each element in the sub array A[1],A[2], A[n-1] and inserted at an appropriate position. Page 1

32 6. What are the steps for selection sort? x The algorithm divides the input list into two parts: the sublist of items already sorted, which is built up from left to right at the front (left) of the list, and the sublist of items remaining to be sorted that occupy the rest of the list. x Initially, the sorted sublist is empty and the unsorted sublist is the entire input list. x The algorithm proceeds by finding the smallest (or largest, depending on sorting order) element in the unsorted sublist, exchanging it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right. 7. What is meant by shell sort? Shell sort, also known as Shell sort or Shell's method, is an in-place comparison sort. Itcan either be seen as a generalization of sorting by exchange (bubble sort) or sorting by insertion (insertion sort). [1] The method starts by sorting elements far apart from each other and progressively reducing the gap between them. Starting with far apart elements can move some out-of-place elements into position faster than a simple nearest neighbor exchange. Donald Shell published the first version of this sort in The running time of Shell sort is heavily dependent on the gap sequence it uses 8. What are the steps in quick sort? The steps are: a. Pick an element, called a pivot, from the list. b. Reorder the list so that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation. c. Recursively apply the above steps to the sub-list of elements with smaller valuesand separately to the sub-list of elements with greater values. 9. Define radix sort Radix Sort is a clever and intuitive little sorting algorithm. Radix sort is a noncomparative integer sorting algorithm that sorts data with integer keys by grouping keysby the individual digits which share the same significant position and value. Radix Sort puts the elements in order by comparing the digits of the numbers. 10. What are the advantages of insertion sort Advantages a. Simplest sorting technique and easy to implement b. It performs well in the case of smaller lists. c. It leverages the presence of any existing sort pattern in the list Page 2

33 Disadvantages x Efficiency of O(n ) is not well suited for large sized lists x It requires large number of elements to be shifted 11. Define searching Searching refers to determining whether an element is present in a given list of elements or not. If the element is present, the search is considered as successful, otherwise it is considered as an unsuccessful search. The choice of a searching technique is based on the following factors a. Order of elements in the list i.e., random or sorted b. Size of the list 12. Mention the types of searching The types are x Linear search x Binary search 13. What is meant by linear search? Linear search or sequential search is a method for finding a particular value in alistthat consists of checking every one of its elements, one at a time and in sequence, until the desired one is found. 14. What is binary search? For binary search, the array should be arranged in ascending or descending order. In each step, the algorithm compares the search key value with the middle element of the array. If the key match, then a matching element has been found and its index, or position, is returned. Otherwise, if the search key is less than the middle element, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the search key is greater, on the sub-array to the right. 15. Define hashing function A hashing function is a key-to-transformation, which acts upon a given key to compute the relative position of the key in an array. A simple hash function HASH(KEY_Value)= (KEY_Value)mod(Table-size) 16. What is open addressing? Open addressing is also called closed hashing, which is an alternative to resolve the collisions with linked lists. In this hashing system, if a collision occurs, alternative cells are tired until an empty cell is found. Page 3

34 There are three strategies in open addressing: x Linear probing x Quadratic probing x Double hashing 17. What are the collision resolution methods? The following are the collision resolution methods x Separate chaining x Open addressing x Multiple hashing 18. Define separate chaining It is an open hashing technique. A pointer field is added to each record location, when an overflow occurs, this pointer is set to point to overflow blocks making a linked list. In this method, the table can never overflow, since the linked lists are only extended upon the arrival of new keys. Part B 1. Explain the sorting algorithms 2. Explain the searching algorithms 3. Explain hashing 4. Explain open addressing 5. Write a C program to sort the elements using bubble sort. 6. Write a C program to perform searching operations using linear and binary search. 7. Explain in detail about separate chaining. Page 4

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

CS PROGRAMMING & ATA STRUCTURES I. UNIT I Part - A

CS PROGRAMMING & ATA STRUCTURES I. UNIT I Part - A CS6202 - PROGRAMMING & ATA STRUCTURES I Question Bank UNIT I Part - A 1. What are Keywords? 2. What is the difference between if and while statement? 3. What is the difference between while loop and do

More information

V.S.B ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY I IT-II Semester. Sl.No Subject Name Page No. 1 Programming & Data Structures-I 2

V.S.B ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY I IT-II Semester. Sl.No Subject Name Page No. 1 Programming & Data Structures-I 2 V.S.B ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY I IT-II Semester Sl.No Subject Name Page No. 1 Programming & Data Structures-I 2 CS6202 - PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1.

More information

CS6202 - PROGRAMMING & DATA STRUCTURES I Unit IV Part - A 1. Define Stack. A stack is an ordered list in which all insertions and deletions are made at one end, called the top. It is an abstract data type

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : I / II Section : CSE - 1 & 2 Subject Code : CS6202 Subject Name : Programming and Data Structures-I Degree & Branch : B.E C.S.E. 2 MARK

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

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

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

Reg. No. : Question Paper Code : 27157

Reg. No. : Question Paper Code : 27157 WK 3 Reg. No. : Question Paper Code : 27157 B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2015. Time : Three hours Second Semester Computer Science and Engineering CS 6202 PROGRAMMING AND DATA STRUCTURES

More information

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR-621113 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING GE6151 COMPUTER PROGRAMMING PART A (2 MARKS QUESTION WITH ANSWERS)

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

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

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3 UNIT 3 LINEAR DATA STRUCTURES 1. Define Data Structures Data Structures is defined as the way of organizing all data items that consider not only the elements stored but also stores the relationship between

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

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

UNIT IV-2. The I/O library functions can be classified into two broad categories:

UNIT IV-2. The I/O library functions can be classified into two broad categories: UNIT IV-2 6.0 INTRODUCTION Reading, processing and writing of data are the three essential functions of a computer program. Most programs take some data as input and display the processed data, often known

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

DATA STRUCUTRES. A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.

DATA STRUCUTRES. A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. DATA STRUCUTRES A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. An algorithm, which is a finite sequence of instructions, each of which

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

Preprocessing directives are lines in your program that start with `#'. The `#' is followed by an identifier that is the directive name.

Preprocessing directives are lines in your program that start with `#'. The `#' is followed by an identifier that is the directive name. Unit-III Preprocessor: The C preprocessor is a macro processor that is used automatically by the C compiler to transform your program before actual compilation. It is called a macro processor because it

More information

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu. 7CA00 PROBLEM SOLVING AND PROGRAMMING Academic Year : 08-09 Programme : P.G-MCA Question Bank Year / Semester : I/I Course Coordinator: A.HEMA Course Objectives. To understand the various problem solving

More information

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C Overview of C Constants, Variables and Data Types Operators and Expressions Managing Input and Output operators Decision Making

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

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

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

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

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

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

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

Programming and Data Structure Solved. MCQs- Part 2

Programming and Data Structure Solved. MCQs- Part 2 Programming and Data Structure Solved MCQs- Part 2 Programming and Data Structure Solved MCQs- Part 2 Unsigned integers occupies Two bytes Four bytes One byte Eight byte A weather forecasting computation

More information

Code No: R Set No. 1

Code No: R Set No. 1 Code No: R05010106 Set No. 1 1. (a) Draw a Flowchart for the following The average score for 3 tests has to be greater than 80 for a candidate to qualify for the interview. Representing the conditional

More information

SAURASHTRA UNIVERSITY

SAURASHTRA UNIVERSITY SAURASHTRA UNIVERSITY RAJKOT INDIA Accredited Grade A by NAAC (CGPA 3.05) CURRICULAM FOR B.Sc. (Computer Science) Bachelor of Science (Computer Science) (Semester - 1 Semester - 2) Effective From June

More information

1 P age DS & OOPS / UNIT II

1 P age DS & OOPS / UNIT II UNIT II Stacks: Definition operations - applications of stack. Queues: Definition - operations Priority queues - De que Applications of queue. Linked List: Singly Linked List, Doubly Linked List, Circular

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

Linked List. April 2, 2007 Programming and Data Structure 1

Linked List. April 2, 2007 Programming and Data Structure 1 Linked List April 2, 2007 Programming and Data Structure 1 Introduction head A linked list is a data structure which can change during execution. Successive elements are connected by pointers. Last element

More information

Lists, Stacks, and Queues. (Lists, Stacks, and Queues ) Data Structures and Programming Spring / 50

Lists, Stacks, and Queues. (Lists, Stacks, and Queues ) Data Structures and Programming Spring / 50 Lists, Stacks, and Queues (Lists, Stacks, and Queues ) Data Structures and Programming Spring 2016 1 / 50 Abstract Data Types (ADT) Data type a set of objects + a set of operations Example: integer set

More information

Contents. A Review of C language. Visual C Visual C++ 6.0

Contents. A Review of C language. Visual C Visual C++ 6.0 A Review of C language C++ Object Oriented Programming Pei-yih Ting NTOU CS Modified from www.cse.cuhk.edu.hk/~csc2520/tuto/csc2520_tuto01.ppt 1 2 3 4 5 6 7 8 9 10 Double click 11 12 Compile a single source

More information

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions.

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions. 1 of 22 8/4/2018, 4:03 PM Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008

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

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24 Prepared By ASCOL CSIT 2070 Batch Institute of Science and Technology 2065 Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass

More information

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours TED (10)-3071 Reg. No.. (REVISION-2010) (Maximum marks: 100) Signature. FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours PART

More information

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

( Word to PDF Converter - Unregistered )   FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT V 2 MARKS ( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING FUNCTIONS AND POINTERS UNIT V Handling of Character Strings User-defined Functions

More information

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

End-Term Examination Second Semester [MCA] MAY-JUNE 2006 (Please write your Roll No. immediately) Roll No. Paper Code: MCA-102 End-Term Examination Second Semester [MCA] MAY-JUNE 2006 Subject: Data Structure Time: 3 Hours Maximum Marks: 60 Note: Question 1.

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

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

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

DEEPIKA KAMBOJ UNIT 2. What is Stack?

DEEPIKA KAMBOJ UNIT 2. What is Stack? What is Stack? UNIT 2 Stack is an important data structure which stores its elements in an ordered manner. You must have seen a pile of plates where one plate is placed on top of another. Now, when you

More information

CS301 - Data Structures Glossary By

CS301 - Data Structures Glossary By CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm

More information

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

CS8391-DATA STRUCTURES QUESTION BANK UNIT I CS8391-DATA STRUCTURES QUESTION BANK UNIT I 2MARKS 1.Define data structure. The data structure can be defined as the collection of elements and all the possible operations which are required for those

More information

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

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

More information

17CS33:Data Structures Using C QUESTION BANK

17CS33:Data Structures Using C QUESTION BANK 17CS33:Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C Learn : Usage of structures, unions - a conventional tool for handling a group of logically

More information

PESIT Bangalore South Campus Department of MCA Course Information for

PESIT Bangalore South Campus Department of MCA Course Information for 1. GENERAL INFORMATION: PESIT Bangalore South Campus Department of MCA Course Information for Data Structures Using C(13MCA21) Academic Year: 2015 Semester: II Title Code Duration (hrs) Lectures 48 Hrs

More information

Introduction to C Final Review Chapters 1-6 & 13

Introduction to C Final Review Chapters 1-6 & 13 Introduction to C Final Review Chapters 1-6 & 13 Variables (Lecture Notes 2) Identifiers You must always define an identifier for a variable Declare and define variables before they are called in an expression

More information

UNIT-2 Stack & Queue

UNIT-2 Stack & Queue UNIT-2 Stack & Queue 59 13. Stack A stack is an Abstract Data Type (ADT), commonly used in most programming languages. It is named stack as it behaves like a real-world stack, for example a deck of cards

More information

Introduction to Data Structures and Algorithms

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

More information

a) State the need of data structure. Write the operations performed using data structures.

a) State the need of data structure. Write the operations performed using data structures. 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

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

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

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should Use better data structures

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

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 themodel answer scheme. 2) The model answer and the answer written by candidate may

More information

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the elements may locate at far positions

More information

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco CS 326 Operating Systems C Programming Greg Benson Department of Computer Science University of San Francisco Why C? Fast (good optimizing compilers) Not too high-level (Java, Python, Lisp) Not too low-level

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

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

Darshan Institute of Engineering & Technology for Diploma studies Unit 4

Darshan Institute of Engineering & Technology for Diploma studies Unit 4 Pointer A pointer is a variable that contains address or location of another variable. Pointer is a derived data type in C. Pointers contain memory address as their values, so they can also be used to

More information

Department of Computer Science and Technology

Department of Computer Science and Technology UNIT : Stack & Queue Short Questions 1 1 1 1 1 1 1 1 20) 2 What is the difference between Data and Information? Define Data, Information, and Data Structure. List the primitive data structure. List the

More information

The Waite Group's. New. Primer Plus. Second Edition. Mitchell Waite and Stephen Prata SAMS

The Waite Group's. New. Primer Plus. Second Edition. Mitchell Waite and Stephen Prata SAMS The Waite Group's New Primer Plus Second Edition Mitchell Waite and Stephen Prata SAMS PUBLISHING A Division of Prentice Hall Computer Publishing 11711 North College, Carmel, Indiana 46032 USA Contents

More information

CP2 Revision. theme: dynamic datatypes & data structures

CP2 Revision. theme: dynamic datatypes & data structures CP2 Revision theme: dynamic datatypes & data structures structs can hold any combination of datatypes handled as single entity struct { }; ;

More information

Advanced C Programming Topics

Advanced C Programming Topics Introductory Medical Device Prototyping Advanced C Programming Topics, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Operations on Bits 1. Recall there are 8

More information

Question Bank Subject: Advanced Data Structures Class: SE Computer

Question Bank Subject: Advanced Data Structures Class: SE Computer Question Bank Subject: Advanced Data Structures Class: SE Computer Question1: Write a non recursive pseudo code for post order traversal of binary tree Answer: Pseudo Code: 1. Push root into Stack_One.

More information

Mode Meaning r Opens the file for reading. If the file doesn't exist, fopen() returns NULL.

Mode Meaning r Opens the file for reading. If the file doesn't exist, fopen() returns NULL. Files Files enable permanent storage of information C performs all input and output, including disk files, by means of streams Stream oriented data files are divided into two categories Formatted data

More information

Information Science 2

Information Science 2 Information Science 2 - Basic Data Structures- Week 02 College of Information Science and Engineering Ritsumeikan University Today s class outline l Basic data structures: Definitions and implementation

More information

CS6202 PROGRAMING AND DATASTRUCTURE-I

CS6202 PROGRAMING AND DATASTRUCTURE-I T.J.S.ENGINEERING COLLEGE PREPARED BY BALAMURUGAN.A.G ASSISTANT PROFESSOR 16 UNIT 1(C PROGRAMMING FUNDAMENTALS- A REVIEW) 1. GIVE TWO EXAMPLES OF C PREPROCESSORS WITH SYNTAX #define- Substitutes a preprocessor

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May www.jwjobs.net R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 *******-****** 1. a) Which of the given options provides the

More information

Computer Systems Lecture 9

Computer Systems Lecture 9 Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions

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 Common to: CSE 2 nd sem IT 2 nd sem Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name Course Code Class Branch DATA STRUCTURES ACS002 B. Tech

More information

Linear Data Structure

Linear Data Structure Linear Data Structure Definition A data structure is said to be linear if its elements form a sequence or a linear list. Examples: Array Linked List Stacks Queues Operations on linear Data Structures Traversal

More information

Programming Fundamentals

Programming Fundamentals Programming Fundamentals Day 4 1 Session Plan Searching & Sorting Sorting Selection Sort Insertion Sort Bubble Sort Searching Linear Search Binary Search File Handling Functions Copyright 2004, 2 2 Sorting

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

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites: C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

Problem Solving and 'C' Programming

Problem Solving and 'C' Programming Problem Solving and 'C' Programming Targeted at: Entry Level Trainees Session 15: Files and Preprocessor Directives/Pointers 2007, Cognizant Technology Solutions. All Rights Reserved. The information contained

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

EL6483: Brief Overview of C Programming Language

EL6483: Brief Overview of C Programming Language EL6483: Brief Overview of C Programming Language EL6483 Spring 2016 EL6483 EL6483: Brief Overview of C Programming Language Spring 2016 1 / 30 Preprocessor macros, Syntax for comments Macro definitions

More information

CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar

CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar Faculty Name: Ami D. Trivedi Class: FYBCA Subject: US02CBCA01 (Advanced C Programming and Introduction to Data Structures) *UNIT 3 (Introduction to Data

More information

12 Abstract Data Types

12 Abstract Data Types 12 Abstract Data Types 12.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT). Define

More information

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty! Chapter 6 - Functions return type void or a valid data type ( int, double, char, etc) name parameter list void or a list of parameters separated by commas body return keyword required if function returns

More information

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

COMP322 - Introduction to C++ Lecture 02 - Basics of C++ COMP322 - Introduction to C++ Lecture 02 - Basics of C++ School of Computer Science 16 January 2012 C++ basics - Arithmetic operators Where possible, C++ will automatically convert among the basic types.

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

Cpt S 122 Data Structures. Data Structures

Cpt S 122 Data Structures. Data Structures Cpt S 122 Data Structures Data Structures Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Introduction Self Referential Structures Dynamic Memory Allocation

More information

CS8391-DATA STRUCTURES

CS8391-DATA STRUCTURES ST.JOSEPH COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERI NG CS8391-DATA STRUCTURES QUESTION BANK UNIT I 2MARKS 1.Explain the term data structure. The data structure can be defined

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

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

Flow Control. CSC215 Lecture

Flow Control. CSC215 Lecture Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements

More information

Program Design (II): Quiz2 May 18, 2009 Part1. True/False Questions (30pts) Part2. Multiple Choice Questions (40pts)

Program Design (II): Quiz2 May 18, 2009 Part1. True/False Questions (30pts) Part2. Multiple Choice Questions (40pts) Class: No. Name: Part1. True/False Questions (30pts) 1. Function fscanf cannot be used to read data from the standard input. ANS: False. Function fscanf can be used to read from the standard input by including

More information