Introduction to Programming
COURSE OBJECTIVES:
- To introduce students to the fundamentals of computer programming.
 - To provide hands-on experience with coding and debugging.
 - To foster logical thinking and problem-solving skills using programming.
 - To familiarize students with programming concepts such as data types, control structures, functions, and arrays.
 - To encourage collaborative learning and teamwork in coding projects.
 
COURSE OUTCOMES: A student after completion of the course will be able to
CO1: Understand basics of computers, the concept of algorithm and algorithmic thinking.
CO2: Analyse a problem and develop an algorithm to solve it.
CO3: Implement various algorithms using the C programming language.
CO4: Understand more advanced features of C language.
CO5: Develop problem-solving skills and the ability to debug and optimize the code.
UNIT I Introduction to Programming and Problem Solving History of Computers, Basic organization of a computer: ALU, input-output units, memory, program counter, Introduction to Programming Languages, Basics of a Computer Program- Algorithms, flowcharts (Using Dia Tool), pseudo code. Introduction to Compilation and Execution, Primitive Data Types, Variables, and Constants, Basic Input and Output, Operations, Type Conversion, and Casting. Problem solving techniques: Algorithmic approach, characteristics of algorithm, Problem solving strategies: Top-down approach, Bottom-up approach, Time and space complexities of algorithms.
UNIT II Control Structures Simple sequential programs Conditional Statements (if, if-else, switch), Loops (for, while, do- while) Break and Continue.
UNIT III Arrays and Strings Arrays indexing, memory model, programs with array of integers, two dimensional arrays, Introduction to Strings.
UNIT IV Pointers & User Defined Data types Pointers, dereferencing and address operators, pointer and address arithmetic, array manipulation using pointers, User-defined data types-Structures and Unions.
UNIT V Functions & File Handling Introduction to Functions, Function Declaration and Definition, Function call Return Types and Arguments, modifying parameters inside functions using pointers, arrays as parameters. Scope and Lifetime of Variables, Basics of File Handling Note: The syllabus is designed with C Language as the fundamental language of implementation.
TEXTBOOKS: 1. "The C Programming Language", Brian W. Kernighan and Dennis M. Ritchie, Prentice- Hall, 1988 2. Schaum’s Outline of Programming with C, Byron S Gottfried, McGraw-Hill Education, 1996
REFERENCE BOOKS: 1. Computing fundamentals and C Programming, Balagurusamy, E., McGraw-Hill Education, 2008. 2. Programming in C, Rema Theraja, Oxford, 2016, 2nd edition 3. C Programming, A Problem Solving Approach, Forouzan, Gilberg, Prasad, CENGAGE, 3rd edition
Important Questions
2 MARKS Questions
UNIT I – Introduction to Programming and Problem Solving
1. Define an algorithm? Write the characteristics of an algorithm.
2. Describe the role of the Program Counter in the instruction cycle.
3. What is the role of the ALU in a computer system?
4. Define flowchart? Explain about different symbols in Flow chart?
5. What is the difference between top-down and bottom-up approaches?
6. Define input unit and output unit from Basic computer organization.
7. Define an expression? Explain types of expressions.
8. Explain the purpose of the conditional operator (?:) with example
UNIT II – Control Structures
9. What is a loop? Explain different statements in C with example.
10. What is the need of do-while and while loops? Discuss about their usage.
Distinguish between them.
11. Explain nested-if conditional control statements supported by C language with syntax and flowcharts.
12. What is the need of do-while loop? Discuss about their usage with neat flowchart and syntax.
13. Write the syntax of an if-else statement in C.
14. What is a switch statement? When is it used?
15. Distinguish between the impact of break and continue statement on loop control flow and iteration count.
UNIT III – Arrays and Strings
16. Define an array. How is it declared in C?
17. What is the difference between one-dimensional and two-dimensional arrays?
18. Write the syntax for declaring a string in C.
19. Explain how array elements are stored in memory.
20. How do you initialize an array in C?
21. Write a C statement to read 5 integer values into an array.
22. What is the difference between array name and array index?
23. Write a program segment to find the sum of elements in an array.
24. What is the purpose of the null character in strings?
25. How can you copy one string into another using a function?
UNIT IV – Pointers and User-Defined Data Types
31. Define a pointer. How is it declared?
32. What is the use of the address-of (&) operator?
33. Differentiate between pointer and array.
34. Explain dereferencing with an example.
35. What is pointer arithmetic? Give an example.
36. Write the syntax for defining a structure in C.
37. What is the difference between structure and union?
38. How can a pointer be used to access array elements?
39. Explain how to access members of a structure using a pointer.
40. What are the advantages of using structures?
UNIT V – Functions and File Handling
41. Define a function. What are its advantages?
42. What is the difference between call by value and call by reference?
43. Write the general form of a function definition in C.
44. What is the scope and lifetime of a variable?
45. Explain the concept of recursion with an example.
46. What are formal and actual parameters?
47. What is a header file? Mention any two standard header files.
48. Define file handling. Why is it used?
49. What are the different modes used in fopen() function?
50. Write a simple program segment to write data into a file.
5 Mark Questions
UNIT I – Introduction to Programming and Problem Solving
1. Explain how Datatypes define storage size, value range, format specifier with neat table.
2. write a C program to find the second largest number among them.
3. Explain the role of precedence and associativity rules in evaluating an expression in C and write the operator precedence table. Give the step-by-step evaluation of an arithmetic expression by taking example.
4. Why type casting is important in C programming? Explain different type conversions supported by C with appropriate examples.
5. Write a simple C program that takes two integers as input and prints the sum as output.
6. Explain the basic structure of C program and explain their significance of each section.
7. List out the various category of operators available in c? Give examples.
UNIT II – Control Structures
10. Develop a ‘C’ program to check whether a given number (N) is a perfect number or not.
11. Demonstrate the loops in C language with the help of syntax and flow charts.
12. Explain different decision-making statements in C with examples.
13. Build a program that reads a positive number N and checks whether it is an Armstrong number.
14. Write a C program that reads a positive number N and prints the squares of numbers from 1 to N.
15. Demonstrate the switch statement with a suitable example.
16. Build a Program to find the sum of all even numbers from 1 to N.
17. Explain the use of break and continue statements with suitable examples.
UNIT III – Arrays and Strings
1. Explain how arrays are stored in memory. Write a program to find the sum and average of elements in an array.
2. Differentiate between one-dimensional and two-dimensional arrays with suitable examples.
3. Write a program to perform matrix addition using two-dimensional arrays.
4. Explain string handling functions in C with examples (strlen, strcpy, strcat, strcmp).
5. Write a program to count vowels and consonants in a given string.
6. Discuss advantages and limitations of using arrays in C programming.
UNIT IV – Pointers and User-Defined Data Types
1. Explain pointer declaration, initialization, and arithmetic with suitable examples.
2. Write a program to swap two numbers using pointers.
3. Differentiate between structures and unions with examples.
4. Write a program to store and display student details using structures.
5. Explain how arrays and pointers are related in C.
6. Write a short note on pointer to structure and demonstrate with an example.
UNIT V – Functions and File Handling
1. Explain the different types of functions in C with suitable examples.
2. Write a program to find the factorial of a number using recursion.
3. Explain call by value and call by reference with appropriate examples.
4. Discuss the concept of variable scope and lifetime with examples.
5. Write a program to read and write student data into a file using file handling functions.
6. Explain the different file handling functions in C (fopen, fclose, fprintf, fscanf, fgets, fputs).
0 comments:
Post a Comment