Tuesday, October 15, 2019

3rd sem COMMUNICATION SYSTEM














2019admn: INTRODUCTION TO C PROGRAMMING

1B01CSC  : INTRODUCTION TO C PROGRAMMING

Unit I:

Computer Programming and Languages: Introduction, Developing a Program, Program Development Cycle, Algorithm, Flowchart: Flowchart Symbols, Guidelines for Preparing Flowcharts, Benefits of Flowcharts, Limitations of Flowcharts, Examples of Algorithm and Flowchart. 

Unit II:

Overview of C: History of C, Importance of C, Basic Structure of C Programming Style, Executing a C program, Source Code, Object Code, Executable File, File Extensions, Character Set, C Tokens - Keywords, Identifiers, Constants, Variables, Data Types, Declaration of Variables, Assigning Values to Variables, Reading Data from Keyboard, Operators and Expressions: Arithmetic Operator, Relational Operators, Logical Operators, Assignment Operators, Increment and Decrement Operators, Conditional Operator, Bitwise Operator, Special Operators,. Arithmetic Expressions, Precedence of Arithmetic Operators, Type Conversion in Expressions. 

Unit III

Managing Input Output Operation: Reading a Character, Writing a Character, Formatted Input, Formatted Output. Decision Making and Branching: Decision Making with if Statement - Simple if, if - else, Nested if - else, else if Ladder, switch Statement, go to Statement, Decision Making and Looping: while, do-while, for Statement, Jumps in Loops - break and continue Statements.

Unit IV

Arrays: Introduction, One Dimensional Arrays - Declaration of Arrays, Initialization of Arrays; Two-Dimensional Arrays - Initializing Two-Dimensional Arrays, Multi-Dimensional Array, Handling of Character Strings: Introduction, Declaring and Initializing String Variables, Reading a Line of Text, Writing Strings to Screen, Arithmetic Operations on Characters, String Handling functions: strlen, strcpy, strcmp, strcat, strrev.

Model Question

1B01CSC Introduction to C Programming

Time: 3 Hours                                                  Max. Marks: 40

Part A: Short Answer

Answer all questions (6 x 1 = 6 Marks) 

1. What are the advantages of arrays? 
2. Define the term algorithm 
3. Explain the purpose of getchar() function 
4. What is source code? 
5. What is a keyword? 
6. Define the term string. 

Part B: Short Essay

Answer any 6 questions (6 x 2 = 12 Marks) 

7. Which function is used to read a line of text in C?
8. Write notes on limitations of flowchart 
9. Explain switch statement in C. 
10. Explain the working of increment Operator with an example 
11. Explain go-to statement in detail 
12. Explain the basic structure of C language. 
13. Explain working of strcmp() function. 
14. How do you initialize an array in C? explain with suitable examples

Part C: Essay

Answer any 4 questions (4 x 3 = 12 Marks) 

15. Explain benefits of flowchart. 
16. Write notes on conditional operator with an example program. 
17. Write a program to perform matrix addition. 
18. Write a program to print prime numbers within range. 
19. Explain the difference between while and do-while loop in detail.
20. Write algorithm to find the largest number among three numbers. 

Part D: Long Essay

Answer any 2 questions (2 x 5 = 10 Marks) 

21. Write an algorithm and flowchart to swap two Numbers without using temporary variable. 
22. Write detailed note on data types in C language. 
23. Explain about the looping statements in C. 
24. Explain string-handling functions in detail.



IMPORTANT QUESTIONS

Advantages of Algorithms:

1.It is a step-wise representation of a solution to a given problem, which makes it easy to understand.
2.A n algorithm uses a definite procedure.
3. It is not dependent on any programming language, so it is easy to understand for anyone even without programming knowledge.
4. Every step in an algorithm has its own logical sequence so it is easy to debug.
5. By using algorithm, the problem is broken down into smaller pieces or steps hence, it is easier for programmer to convert it into an actual program.

Disdvantages of Algorithms:

1.Alogorithms is Time consuming.
2. Difficult to show Branching and Looping in Algorithms.
3. Big tasks are difficult to put in Algorithms.

Advantages of flowchart:

1.The Flowchart is an excellent way of communicating the logic of a program.
2.It is easy and efficient to analyze problem using flowchart.
3.During program development cycle, the flowchart plays the role of a guide or a blueprint. Which makes program development process easier.
4.After successful development of a program, it needs continuous timely maintenance during the course of its operation. The flowchart makes program or system maintenance easier.
5.It helps the programmer to write the program code.
6.It is easy to convert the flowchart into any programming language code as it does not use any specific programming language concept.

Disadvantage of flowchart

1.The flowchart can be complex when the logic of a program is quite complicated.
2.Drawing flowchart is a time-consuming task.
3.Difficult to alter the flowchart. Sometimes, the designer needs to redraw the complete flowchart to change the logic of the flowchart or to alter the flowchart.
4.Since it uses special sets of symbols for every action, it is quite a tedious task to develop a flowchart as it requires special tools to draw the necessary symbols.
5.In the case of a complex flowchart, other programmers might have a difficult time understanding the logic and process of the flowchart.
6.It is just a visualization of a program, it cannot function like an actual program.

Advantages of array

1.It is better and convenient way of storing the data of same datatype with same size.
2.It allows us to store known number of elements in it.
3.It allocates memory in contiguous memory locations for its elements. It does not allocate any extra space/ memory for its elements. Hence there is no memory overflow or shortage of memory in arrays.
4.Iterating the arrays using their index is faster compared to any other methods like linked list etc.
5.It allows to store the elements in any dimensional array - supports multidimensional array.

Disadvantages of array

1.It allows us to enter only fixed number of elements into it. We cannot alter the size of the array once array is declared. Hence if we need to insert more number of records than declared then it is not possible. We should know array size at the compile time itself.
2.Inserting and deleting the records from the array would be costly since we add / delete the elements from the array, we need to manage memory space too.

3.It does not verify the indexes while compiling the array. In case there is any indexes pointed which is more than the dimension specified, then we will get run time errors rather than identifying them at compile time.