Docsity

Programming Concepts-Computer Science-Assignment, Exercises of Computer Programming

Toggle sidebar
bg1
1
]
ASSIGNMENT No. 1
(Units: 1โ€“4)
Course: Programming Concepts (3402) Semester: Spring, 2012
Level: BS (CS) Total Marks: 100
Pass Marks: 50
Note: All questions are compulsory. Each question carries equal marks.
Q. 1 Explain the difference between the following:
(a) Editor and the Compiler
(b) Source program and the object program
Q. 2 (a) How can you use pseudo code and flo w charts to solve different problems
related to programming? Explain.
(b) Explain the purpose and advantages of using comments in C/C++ Language.
Q. 3 (a) Write a sim ple program in C/C++ demonstrating the functions of relational
operators.
(b) Differentiate between syntax errors and logical errors.
Q. 4 (a) Differentiate between Input and Output in C/C++ lan guage. Which libraries
and keywords and required for Input and Output in a C/C++ program?
(b) Write a simple program in C/C++ demonstrating the functions of assignment
and logical operators.
Q. 5 (a) Write a progra m in C/C ++ using nested if state ment for calcu lating the
average marks and grades of 5 subjects.
(b) Write a program in C/C++ using switch statement for calculating the average
marks and grades of 5 subjects.
docsity.com
pf3
pf4

Partial preview of the text

Download Programming Concepts-Computer Science-Assignment and more Exercises Computer Programming in PDF only on Docsity!

]

ASSIGNMENT No. 1

(Units: 1โ€“4)

Course: Programming Concepts (3402) Semester: Spring, 2012 Level: BS (CS) Total Marks: 100 Pass Marks: 50

Note: All questions are compulsory. Each question carries equal marks.

Q. 1 Explain the difference between the following: (a) Editor and the Compiler (b) Source program and the object program

Q. 2 (a) How can you use pseudo code and flo w charts to solve different problem s related to programming? Explain. (b) Explain the purpose and advantages of using comments in C/C++ Language.

Q. 3 (a) Write a sim ple program in C/C++demonstrating the functions of relational operators. (b) Differentiate between syntax errors and logical errors.

Q. 4 (a) Differentiate between Input andOutput in C/C++ lan guage. Which libraries and keywords and required for Input and Output in a C/C++ program? (b) Write a simple program in C/C++ demonstrating the functions of assignment and logical operators.

Q. 5 (a) Write a progra m in C/C ++ using nested if state ment for calcu lating the average marks and grades of 5 subjects. (b) Write a program in C/C++ using switch statement for calculating the average marks and grades of 5 subjects.

ASSIGNMENT No. 2

(Units: 5โ€“8) Total Marks: 100 Pass Marks: 50

Q. 1 (a) Write a program that prints the squares of all the numbers from 1 to 20. (b) What is the d ifference in execution sequence of the body of a do- while loop and a while loop? Explain with examples.

Q. 2 (a) What is the difference bet ween break and continue statements? Explain with the help of suitable example. (b) For what purpose functions ar e used? Explain the structure of functions with the help of an example.

Q. 3 (a) What is a return statement? What are its limitations? (b) What are pre-processor directives? Explain the concept of header files. (c) What are the main differences between functions and macros? Explain.

Q. 4 (a) How single dim ensional, two-dimensional, and three -dimensional arrays are initialized? How these ar rays can be passed as arguments? Explain by using an example. (b) How sorting operation can be performed on arr ays? Explain the sorting operation by using bubble sort.

Q. 5 (a) What is a pointer? Why are pointers used? What is an indirection operator? (b) How pointer variables are defined? How values are supplied to pointer variables? (c) Write a program using po inter notation to ac cess in dividual elements of an array and print the sum and average of the elements of the array.

3402 Programming Concepts Credit Hours: 4 (3+1)

Recommended Book: The Wait Group's Turbo C Programming for the PC and Turbo C++ by Robert Lafore

Objectives: This course primarily aims at developing ke y el ementary concepts in computer programming. The objectives of the co urse are to explain (Fou ndation of computer programming, elements of co mputerprogramming, development of structured computer programs, learning of pro gramming language C to im plement structured computer programming)

Unit No. 7 Arrays & Strings Introduction, Single and Multidimensional, Organizing Array Elements, Strings Introduction, String Constant, String V ariable, String I/O functions (gets() and puts()), An array of String Activities: The students shall be given dail y life proble ms and use co mputer laboratory to dem onstrate (Single and Multidimensional, Organizing Array Elem ents, String Const ant, String V ariable, String I/O functions (gets() and puts() ), An array of String

Unit No. 8 Pointers Overview, Pointer Types, Pointers & arrays, Double indirection Activities: The students shall be given daily life problems and u se computer laboratory to dem onstrate (Pointer im plementation,Pointers & array s implem entation, Double indirection)

Unit No. 9 Structures Introduction, Declaring a structure, Accessing structure elements, Entering data into structures, Initializing structures, Array of structures Activities: The students shall be given daily life problems and use computer laboratory to demonstrate (Structure im plementation, Accessing structure elem ents, Entering data into structures, Initializing structures, Using an array of structures)