You are on page 1of 8

Q1.

Multiple Choice Questions : (20 marks)

1.Diagramatic or symbolic representation of an algorithm is called.


 Data-flow Diagram  Flowchart
 Binary Representation  Symbolic Graph

2. File Handling mechanism uses_____.


 FILE  File open
 File close  fclose()

3. Difference between logical and bitwise logical operator.


 && , &  || , &&
 != , ==  None of Above

4. What are C identifiers?


 Variable and Function Name
 The basic element recognised by the compiler
 Smallest unit of program
 None of above

5. In C language all function except main() can be recursively?


 Yes  No
 All time  None of the above

6. Which is the correct syntax to declare constant pointer?


 int *const constPtr  *int const constPtr
 const int * constPtr  None of the Above

7. C program files are directly stored in ____ files.


 Binary  ASCII
c  Notepad
8. Bitwise operation can operate upon?
 Double and char  Float and double
 Int and floats  int and char

9. A variable name can be of __ bits.


8  16
 31 4

10. Which among the following is odd man out.


 Printf  getch
 delay  scanf
11. The value of EOF is ___
1 0
 -1  10

12. Void main function is______.


 <stdio.h>  <conio.h>
 #include  Library Function

13. Functions cannot return more than one value at a time.


 True  False
 Depends  None of above

14. Is the NULL pointer same as an uninitialised pointer?


 Yes  No
 Both  None of Above

15. The expression X = 4+2%-8 evaluates to?


 -6 6
 3s 4

16. Long double stores ____ byte of data.


8  10
 16 4

17. The code a << 1 is equivalent to __________.


 Multiply by 2  Divide by 2
 Adding 2 to a  None of Above

18. A static variable by default gets initialized to


0  Blank space
1  Garbage value

19. Which function reallocates memory ?


 realloc  alloc
 malloc  none of these

20. Literal means _______ ?


 A string  A string constant
 A character  An alphabet
Q2. Write the output for the following code: (20 marks)
1.
main()
{
struct student
{
char name[20];
int roll;
};
student s1 = { "adam", 101 };
student s2 = s1;
printf("%s",s2.name);
}
2.
main()
{
float a = 10.2;
int *p = a;
printf("%d",*p);
}

3.
main()
{
register i=5;
char j[]= "hello";
printf("%s %d",j,i);
}
4.
main()
{
union std
{
int x;
int y;
};
union std s1;
s1.x =10;
s1.y =20;
printf("%d, %d\n",u.x, u.y);
return 0;
}

5.
# include <stdio.h>
int arr[]={1,2,3};
main()
{
int *ptr;
ptr = arr;
ptr = ptr+3;
printf("%d",*ptr);
}
6.
main()
{
long i = 30000;
printf("%d", i);
}
7.
main()
{
register i=5;
char j[]= "hello";
printf("%s %d",j,i);
}

8.
nt fun(int *a,int *b)
{
*a=*a+*b;
*b=*a-*b;
*a=*a-*b;
}
main()
{
int x=10,y=20;
fun(&x,&y);
printf("x= %d y = %d\n",x,y);
}

9.
main()
{
long i = 65536;
printf("%d\n", i);
}
10.
# define SQR(X) (X*X)
main()
{
int a, b = 3;
a = SQR(b+2);
printf("\n%d", a);
}

Q3. Write a C program to input 10 Student name, roll no and percentage and display
the same. (10 marks)

Q4. a). Write a C program to transpose row and column of matrix. (5 marks)
b). Write a C program to find sum of digit using recursion function. (5 marks)

Q5. Write the code for the following output: (15 marks)
1. K
K L
K L M
K L M N
K L M N O

2. 1
23
456
7 8 9 10

3. 1
01
101
0101
10101
Patt1
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
char ch='K';
clrscr();
for(i=1;i<=5;i++)
{
for(j=5-i;j>=1;j--)
{
printf(" ");

}
for(j=1;j<=i;j++)
{
printf("%c ",ch);
ch++;
}
ch='K';

printf("\n");
}

getch();
}

Patt2

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c=1;
clrscr();
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",c);
c++;
}

printf("\n");
}

getch();
}

Patt3

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;

clrscr();
for(i=1;i<=5;i++)
{
for(j=i;j>=1;j--)
{
if(j%2!=0)
printf("1");
else
printf("0");

}
printf("\n");
}

getch();
}