Você está na página 1de 2

PSG POLYTECHNIC COLLEGE, COIMBATORE - 641 004

DIPLOMA ODD SEMESTER EXAMINATIONS OCT 2016

Z15302-PROBLEM SOLVING USING C


MODEL QUESTION PAPER
Time : 3 Hours

Max.Marks: 100

Instructions:
1. Group A and Group B questions should be answered in the Main Answer book.
2. Answer any TEN questions in Group A. Each question carries three marks.
3. Answer ALL questionseither (a) subdivision or (b) subdivision in Group B. Each
question carries 14 marks.
Group A

Marks: 10 x 3 = 30

1.
2.
3.
4.
5.

Write an algorithm to find the area of circle and drawflow chart for it.
Differentiate low level language and high level language.
Mention the steps involved in program development.
Draw the basic structure of c program.
Give the syntax for Ternary operator and also find the output for the following program.
main() {
intx,j,k;
j=k=6;
x=2;
x=j*k;
printf("%d", x);
}
6. Write a program to read the values of x and y and print the result of the expression (x+y) (x-y).
7. How to declare and initialize an array? Give examples.
8. Generate a program to join two strings together, which gives the following output
Output: Enter the string 1: C
Enter the string 2: Programming
String is: CProgramming
9. List out any five String functions with its functionality.
10. Specify the elements of user defined functions and list out the categories of function.
11. How can arrays be passed to a function?
12. Distinguish between local variables and global variables.
13. Compare Structure and Union.
14. Write an output for the given program.
#include <stdio.h>
int main()
{
intvar =10;
int *p;
p= &var;
printf ( "\n Address of var is: %u", &var);
printf ( "\n Address of var is: %u", p);
printf ( "\n Address of pointer p is: %u", &p);
printf ( "\n Value of var is: %d", var);
printf ( "\n Value of var is: %d", *p);
}
15. How the structure variables are declared and accessed?
Group B

Marks: 5 x 14 = 70

16. a )i) Discuss the different types of programming languages with an example.
Page No: 1

(7)

PSG POLYTECHNIC COLLEGE, COIMBATORE - 641 004


DIPLOMA ODD SEMESTER EXAMINATIONS OCT 2016
ii) Design an algorithm and draw a flowchart to find greatest of 3 numbers.

(7)

(OR)

b) i) Write an algorithm and draw a flow chart for an ATM cash withdrawal process.
ii) Illustrate the various steps involved in program development with an example.

(5)
(9)

17. a) i) Develop the program to find the sum of N numbers using looping statements .
(5)
ii) Describe the switch statement and its rules. Define the need of break statement.

(9)

(OR)

b) i)Give the syntax of printf and scanf. Write the output for the following program.
#include<stdio.h>
main()
{
printf("The color: %s\n", "blue");
printf("First number: %d\n", 12345);
printf("Second number: %04d\n", 25);
printf("Third number: %i\n", 1234);
printf("Float number: %3.2f\n", 3.14159);
}

(5)

ii) With an example, explain the various operators used in C.


(9)
18. a) i) Define an array and specify the types of an array. Where the concept of an array is used?
ii) Write a C program to multiply two matrices and display their product.

(5)
(9)

(OR)

b) i) Write a C program to find whether the given string is a palindrome or not using string functions.
(7)
ii) Denote the purpose of the following function
a) gets()
b)puts()

c) getchar()

d)putchar()

(7)

19.a) i) Differentiate call by value with call by reference


(5)
ii)Write a program to calculate factorial of an integer using recursion.

(9)

(OR)

B )i) Discuss about storage classes in C.


(6)
ii) How does the function work? Explain how arguments are passed and results are returned.(8)
20.a) i) How the pointer variable is declared and accessed? Give examples. (6)
ii) Write a function using pointers to exchange the values stored in two locations in the memory.
(8)
(OR)

b)i) Explain the arrays within structures. Mention any three applications of structures.

(7)

ii) Define a structure type, struct employee that would contain employee name, date of joining and
salary. Using this structure, write a program to read this information for one employee from the
keyboard and print the same on the screen.
(7)
/END/
Page No: 2

Você também pode gostar