Wednesday 27 March 2013

APRIL /MAY-2011 (C-09)


C-09-CM-105/C09-IT-105
3025
BOARD DIPLOMA EXAMINATION, (C-09)
APRIL /MAY-2011
DCM-I YEAR EXAMINATION
COMPUTER FUNDAMENTALS & PROGRAMMING IN “C”

TIME: 3 Hours]                                                                     [Total Marks :80]
PART   - A
INSTRUCTION:  (1) ANSWER ALL QUESTION AND EACH QUESTION
                                           CARRIES FOUR MARKS
                    (2)  ANSWER SHOULD BE BRIEF AND   STRAIGHT      TO  THE POINT AND SHALL NOT EXEED FIVE SIMPLE SENTENCES

1.                  What are input/output devices ? Give 2 examples of each. 2+1
2.                  List the various number system used in digital computers.                                                 3
3.                  What is the need of operating system?.                                                          1+2
4.                  What is the role of Modem in accessing the Internet.                                          3
5.                  What is the difference between Algorithm and Flowchart.                                              3
6.                  What is the difference between keyword and identifier in ‘C’ language. Give two example of each.                                                                                                                         3
7.                  What is a pointer in C? How to declare a pointer in C?.                                 2+1
8.                  Differentiate between structure and union?                                                                   3
9.                  What is an array ? How to declare and initialize an array ?                               1+1+1
10.              What are preprocessor directives in ‘C’.                                                                       3



Instructions :    (1) Answer any five questions and each question carries ten marks.
                  (2) The answers should be comprehensive and the criteria for valuation   is the content but not the length of the answer.

11.              Draw the block diagram of computer and explain.                                            6
12.              (a)Describe installing a new software using control panel.                                            5
(b) Explain the process of sending and receiving the e-mails.                                      5
13.              (a) List the components of a window.                                                                         4            (b) Explain :      2+2+6                                                                                                                                (1) FTP (2)Telnet (3) www
14.              (a) Classify the data types in ‘C’ and explain with example.                                         6           
(b)Write about input and output functions printf, scanf in ‘C’                                      2+2
15.  (a) Write a program in ‘C’ to find given positive number.                                         7
(b)Explain various loop statements in ‘C’.                                                               3
16.  (a)  Write a C program in ‘c’ to find given positive number is prime number or not.   7          (b) Explain various loop statements in C.                                                            3
16. (a) Write  C program to sort the given numbers in ascending order in a given array.      6
      (b) Differentiate between array and structure in C.                                                   4
17. (a) Write a program to add given two double dimension matrices.                            6
      (b) Distinguish between Local and Global variable.                                                  2+2
18. (a) What is the relation between Local and Global variable.                                     4
      (b) Write a C program to find factorial of given positive number using recursive function. 6


Answers
Short:
1.                  What are input/output devices ? Give 2 examples of each. 2+1
Ans:
Input devices~
 Input devices are used to collection of the data.
Ex~
·         Keyboard.
·         Mouse.
·         Scanner.
Output devices~
Out put devices are used to show the output or result on the screen.
Ex~
·         Printer.
·         Monitor.
·         Speakers.

2.                  List the various number system used in digital computers.                                                 3
3.                  What is the need of operating system?.                                                          1+2
Ans:
The operating system is the basic program in a computer. The need of the o/s is….
·         All have an o/s that is used for starting the computer and running the other programs
·         The o/s performs important tasks like receiving input from the keyboard and mouse, sending information to the screen, as well as controlling the various unit such as disk printers etc…if o/s is not exits , then these functions are to be performed by the users.
·         O/s provides interface between hardware and users. If o/s is not exits then working with the system will become very difficult .
·         O/s increases the efficiency of the computer system.
Error handling is done by the o/s , if o/s not exits error handling is to be performed by the users.
4.                  What is the role of Modem in accessing the Internet.                                          3
Ans:
·         Modem stands for Modulator/Demodulator.
·         Modems are used to connect the computer to the telephone lines.
·         Standard telephone lines transmit analog signals in which sound is translated into electrical current.
·         As a result, you need a modem to translate data into a form that can be sent over telephone lines.
·         Modem converts the in coming digital signals into analog from and sends the data to the computers.
Modem plays the very important role in exchange data between computers via a telephone line.
5.                  What is the difference between Algorithm and Flowchart.                                           
Ans:
ALGORITHM
FLOW CHART
1)A step by step procedure to solve a problem is known as algorithm
The graphical representation of an algorithm is called a flow chart.
2)It is represented in step by step procedure.
It is represented by diagrammatical method.
3)It is not as easy to understand as flow chart.
It is easy to understand.
4)Drawing tools are not required
Required
5)It is independent
We have to use predefined standard system only
6)Easier to understand
To understand flowcharts one has to be familiar with symbols
7)suitable for the large and modular program
suitable for the small programs

6.                  What is the difference between keyword and identifier in ‘C’ language. Give two example of each.    
Ans:
KEY WORD:At the time of designing the c language some words are used to do a specific task called key words.
They are 32 key words in c language.
EX: int, float, char, double etc…

IDENTIFIER: Identifier is the name given to the variable or a function. An identifier can be written using the following rules:
1)     It can contain character a-z, A-Z, 0-9 OR (_) under scope.
2)     It can contain max of 31 characters
3)     Key words can not be used as identifiers
4)     It must start with either a letter or under scope.
7.          What is a pointer in C? How to declare a pointer in C?.                                 2+1
Ans:
Pointers is used to store the address of the existing variable or array or structure or pointer .
   It is a De-referencing operator (*)
Syntax -- data type *variable name;
                 Variable =&existing variable;
      Ex --    int *p;
                  Int a;
                  P=&a;
8.          Differentiate between structure and union?                                                                   3
Ans:
Structure
Union
1.       Structure stores different types of data in different locations. That is each member within a structure is assigned its own unique storagr area.
2.       All members can be accessed at a time
3.       The memory size of the structure variable is the sum of the sizes of its members.

1.       Union stores different types of data in a single memory location tha are the members that compose    a union all share the same storage area.
2.       Only one member of the union  and thus one data type can be accessed  at any one time
3.       The memory size of the union variable is the largest size of its members

9.          What is an array ? How to declare and initialize an array ?                               1+1+1
    An array is a homogenous collection of elements (or) values which are stored in memory
    An array is also known as the subscripted variable.

Declaration
 Syntax—
                 Data type   variable [size];
                 int list [20];
                 float a[20];
10.        What are preprocessor directives in ‘C’.                                                                       3
Ans:

The preprocessor recognizes the following directives:

#define                         #undef              #elif                  #include            #ifndef                          #error                #pragma

Long
11.              Draw the block diagram of computer and explain.                                            6
12.              (a)Describe installing a new software using control panel.                                            5
(b) Explain the process of sending and receiving the e-mails.                                      5
13.              (a) List the components of a window.                                                                         4            (b) Explain :      2+2+6                                                                                                                                (1) FTP (2)Telnet (3) www
14.              (a) Classify the data types in ‘C’ and explain with example.                                         6           
(b)Write about input and output functions printf, scanf in ‘C’                                      2+2
Print(): It is used to output function. It is used to display the message or output on the monitor
It is a call by value function. It is predefined in <stdio.h>
Syntax:    printf(“control string”, variable);
               printf(“message”);
scanf(): it is used to a input function. It is used to the data from the keyboard at run time.
                It is also predefined in <stdio.h>
   
Syntax:
                scanf (“control”,&var1,&var2);
Eg:
                scanf (“%d%d”,&a,&b);
It is call by address function.
The value or data read from the keyboard and converts by using the format specifiers and stores into variable address

15.  (a) Write a program in ‘C’ to find given positive number.                                         7
(b)Explain various loop statements in ‘C’.                                                               3
Ans:
ANS: C supports the following types of loops
1. The while loop
2. The do while loop
3. The for loop
WHILE LOOP:
                                    This loop is executed repeatedly until condition becomes false. While is a key word.
SYNTAX:
                        Initialization
                        While(condition)
                        {
                                    Statement 1;
                                    Statement 2;
                                    Increment\decrement;
                                    }
DO WHILE LOOP:
                                    First executes the statements of do...while loop after that condition is checked.
If the condition becomes false the control comes out of do...while loop.
If the condition becomes true the control goes to iteration(repeated).
SYNTAX:
                        Initialization;
                        do
                        {
                        Statements;
                        Increment\decrement;
                        }
                        While (condition);
do is a key word.
FOR LOOP:
                        This loop is executed until the same fixed no of times. For is a key word.
SYNTAX:
                        For (initialization; condition; increment\decrement);
            {
            Statement 1;
            Statement 2;
            }
Ans:
#include<stdio.h>
#include<conio.h>
void main()
{
int I,n;
int ctr=0;
printf(“enter any no\n”);
scanf(“%d”&n);
for(i=1;<=n;i++)
{
if(n%i==0)
{
ctr++;
}
}
if(ctr==2)
{
printf(“%d is prime no\n”);
}
else
{
printf(“%d is not a prime no\n”);
}
getch();
}

(b) Explain various loop statements in C.                                                            3
16. (a) Write  C program to sort the given numbers in ascending order in a given array.      6
Ans:
#include<stdio.h>
#include<conio.h>
Void main()
{
int a[10];
Int i,j,temp;
clrscr();
printf(“enter the valurs\n”);
for(i=0;i<=5-1;i++)
{
scanf(“%d”&a[i]);
for(i=0;i<=5-1;i++)
{
for(j=i+1;j<=5-1;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
for(j=0;j<=3;j++)
 {
printf(“%d \n”,a[i]);
}
getch();
}


      (b) Differentiate between array and structure in C.                                                   4
17. (a) Write a program to add given two double dimension matrices.                            6
Ans:
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][3],b[2][3],c[2][3];
int i.j;
clrscr();
for(j=0;j<=3-1;j++)
{
scanf(“%d”,a[ i ][ j ])’
}
for(i=0;i<=2-1;i++)
{
for(j=0;j<=3-1;j++)
{
c[i][j]=a[i][j]+a[i][j];
printf(“%d\t”,c[i][j]);
}
printf(“\n”);
}
getch();
}


      (b) Distinguish between Local and Global variable.                                                  2+2
18. (a) What is the relation between Local and Global variable.                                     4
      (b) Write a C program to find factorial of given positive number using recursive function. 6
Ans:
#include<stdio.h>
#include<conio.h>
void main()
{
   int n,result;
int fact(int n);
printf(“enter n values\n”);
scanf(“%d”,&n);
result=fact(n);
printf(“factorial of %d=%d\n”,n,result);
getch();
}
//fact() function defination
int fact(int n)
{
if (n>0)
{
 return(n*fact(n-1));
}
else
{
  return(1);
}
}

No comments:

Post a Comment