100% found this document useful (1 vote)
93 views9 pages

PC Question - Bank

Uploaded by

pratiksharma2828
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
93 views9 pages

PC Question - Bank

Uploaded by

pratiksharma2828
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PC Question Bank

Short Answer Type Questions


Module-1
1. What is the largest number can be represented using 8 bits? Justify your answer.

2. Among +, &&, =, ++, which operator is having the lowest precedence in ‘C’?

3. Convert the following decimal number to Binary, Hexadecimal and Octal


Number. 24, 64.

4. Find the decimal equivalent of Hexadecimal number of DE.

5. Find the output of the following program for inputting 4567 and 7654
#include<stdio.h>
int main()
{
int a,b;
printf(“Enter two four digit numbers:”);
scanf(“%2d %4d”,&a,&b);
printf(“ The two numbers are %d and %d”, a,b);
return 0;
}

6. What is the meaning of %6.2f in C? Explain with an example.

7. Find out the output of the following code or error if any.


#include<stdio.h>
void main()
{
int x=10,y=20,i;
i= x<y;
printf(“%d”, i);
}

8. Find the output:


int a=5, b=9
printf(“%d”, a&&b);

9. What is ASCII stands for? Explain its importance?

10. Why C is called middle level language?


11. Find the decimal of the binary AND operation of 100101 and 110011.

12. Write the precedence lowest to highest for the arithmetic operator %,*,+,-,/.

13. Differentiate between High level language and Low-level language.

14. Differentiate between Machine level language and Assembly language.

15. What is the purpose of using preprocessor directive in C. Give three example of
preprocessor directive.
16. Differentiate between Global variable and Local variable with example.

17. What is escape sequency? Give example.


18. What is Trigraph Character. Give example.

19. What is a keyword in C. What are its importance?

20. Write a printf statement to get an equivalent octal value for decimal value a=20.

21. Explain the difference between ++a and a++.

22. What is bit wise operator. What are different types of bitwise operator.

23. How to differentiate between Logical AND and Bitwise AND.

24. What is the output of 20<<2

25. What is the output of 20&&40 and 20&40.

Module-2
26. Find the out of the following code.
#include<stdio.h>
int main( )
{
int i;
for(i=0;i<10;i++);
printf(“\n%d”,i);
return 0;
}
27. Write the general syntax of do while loop with example.
28. Find the out of the following code.
#include<stdio.h>
int main( )
{
int a=15;
while(a++<20)
printf(“\n%d”,a);
return 0;
}
29. What is nested for loop, give an example?
30. Differentiate between Nested IF-Else and Ladder if-else statement.
31. Write the syntax to declare a floating array avg and initialize with 76.8, 65,
92.5, 6.
32. What is infinite loop, give an example?
33. Draw the flowchart of Nested If-Else statement.
34. Write the syntax of switch?
35. What is goto, give an example?
36. Which key word is used to forcefully terminate the loop?
37. What is use of continue keyword in a loop? Explain.
38. Differentiate between break and continue statement.
39.
40.
Module-3
41. Write a 2-D array to initialize with the elements.
23
54
97
42. Can we declare a 2-D array without column? If yes or no Justify.
43. What is function recursion?
44. Explain the formal parameter and actual parameter in a function.
45. Write the outputs:
float a=2.8;
printf(“%f”,ceil(a));
printf(“%f”,floor(a));
printf(“%f”,round(a));
46. Write the outputs:
{
char str1=”Hello”;
char str2=”How are You”;
printf(“%s”,strcpy(str1,str2));
printf(“%s”,strcat(str1,str2));
printf(“%s”,strcmp(str1,str2));
47. Compute the output of the program given below?
# include <stdio.h>
int main()
{
char str1[] = "GITA";
char str2[] = {'G', 'I', 'T', 'A'};
int n1 = sizeof(str1)/sizeof(str1[0]);
int n2 = sizeof(str2)/sizeof(str2[0]);
printf("n1 = %d, n2 = %d", n1, n2);
return 0;
}
48. Write a function declaration for a function named as fun, having two integer
arguments, one floating point argument and without return type.
49. Find the output of given program?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[20] = "Hello", str2[20] = " World";
printf("%s\n", strcpy(str2, strcat(str1, str2)));
return 0;
}
50. Write the advantages of function.
51. What do you mean by function prototype?
52. Demonstrate called function and calling function with example.
53.
54.
55.
Module-4
56. What is Pointer in C? Give an example.
57. What is void or Generic pointers in C?
58. Write the advantages of pointer.
59. If ptr is an integer pointer and stores address 6000. Find the value of
ptr=ptr+4; in ANSI C compiler.
60. float * ptr. What is the value of sizeof(ptr)?
61. Why dynamic memory allocation is preferred?
62. Write the difference between malloc( ) and calloc( ).
63. Which function is used to delete the allocated memory, write the syntax
64. What is the need of typecasting in dynamic memory allocation?
65. Write the general syntax of malloc() and calloc()’
Module-5
66. #include<stdio.h>
int main()
{
struct node
{
int x;
//float y;
};
struct node p, *q;

printf("%d, %d\n", sizeof(p), sizeof(q));


return 0;
}

67. Find the output for following code


#include<stdio.h>
struct emp
{
int id;
int age;
float sal;
};
struct emp e1 = {23};
printf("%d\n%d\n%f\n", e1.id,e1.age,e1.sal);
return 0;
}

68. What is Union, Give an example?


69.. What are the ways to declare structure variable?
70.. Write the difference between Structure and Union
71. While using the statement
fp=fopen(“myfile.c”,”wb”) ;
what happens if , myfile.c does not exist on the disk

72. What is the use of “eof”.


73. What is the difference between getchar() and getch()?
74. Point out the errors if any:
void main()
{
FILE * fp;
fp= fopen (“TRY.C”,”Y”);
fclose(fp);
}

75. What is file pointer? Give an example


76. What is binary file?
77. What is the significance of FILE?
78. Write syntax to open a file?
79. Write the use of file mode.
80. File_ptr is the file pointer to the file gita.text. Write the syntax to close the file
gita.text.
Focused Type

Module-1
1. Describe the structure of a C program. Why do we need to use comments in
programs?
2. What is the difference between logical error and syntax error? Explain with
example.
3. Write a flowchart and algorithm for the equation s=ut+(1/2) at2 .
4. What is the difference between a compiler and interpreter?
5. Write the algorithm and draw the flowchart to find the greatest number among 3
numbers.
6. Differentiate between Compiler and Interpeter.
7. Differentiate between Flowchart and Algorithm.
Module-2
8. Write the difference between while and do while.
9. Write the code to input and display a matrix order of 4x5.
10. Write a C code to print following output.
1:5 1:6 1:7
2:5 2:6 2:7
3:5 3:6 3:7
11. Write a program to find the sum of even and odd numbers in between 5 to 35.
12. Write a program to check whether the number is palindrome number or not.
13. Write a program to generate first 20 numbers of a Fibonacci series.
14. Write a program to check whether the number is prime number or not.
15. Write a program to check whether the number Armstrong number or not.
16. WAP to print following Pattern
*
**
***
****
17. WAP to print following Pattern
55555
4444
333
22
1
18. WAP to print following Pattern
A
AB
ABC
ABCD
Module-3
19. Write a program in C to reverse a string without using string functions.
20. Write a program in C to find factorial of a number by using recursive function.
21. How many types of user defined functions are there? Explain briefly.

22. Write a program in C to find the average mark of a student having 5 subjects
using function without argument and with return.

23. Write a program in C to print all even and odd number from 0 to 100 using
pointer.

24. Explain different arithmetic operations possible for pointer with example.
25. WAP to sort the given array of ten elements.
{13,4,27,91,11,45,31 ,73,17,7}
26. WAP to swap value of two variables using call by reference.
27 WAP to add two matrixes of order 3X3.
28. WAP to multiply two dimensional matrices.
Module-4
29. Write the code to input and display a matrix order of 3X3 using pointer variable.

30. WAP in C display five employee record in employee database. The attributes of
employees are employee name, ID, department name, salary. Choose appropriate
datatypes for each attribute.
31. Explain structure member or element, structure variable and its initialization
with example.
32. What is dynamic memory allocation? Describe different functions used for
dynamic memory allocation.
33. Differentiate between static memory allocation and dynamic memory allocation.

34. How memory allocation take care in memory for structure and union describe it
briefly.
35. WAP in C display five student record in student database. The attributes of
students are name, roll no, age, percentage of mark. Choose appropriate
datatypes for each attribute.
36. What do you mean by array of structure explain with example?
Module-5
37. Explain Static storage class.
38. An user wants to create a file mytext.text file which supports to write operation,
after writing into file user will close the file. Write the C code for these
operations.
39. What is a file, where it will be stored and how we can read a file, explain the
step by step process.

40. How scanf() is different from fscanf() and printf() from fprintf().
Long Questions
Module-1
1. i. Draw and explain the architecture of a Computer with components.
ii. Write the algorithm and c program to convert temperature given in
Fahrenheit to centigrade.

2. i. What is C token. Explain in details with example.


ii. Explain in details about C keywords and Identifiers.

3. i. What is Constants? Explain in details with example different constants used


in C.
ii. What do you understand by data type? Explain with example of different
data type used in C.

Module-2
4. i. Write a program to design digital calculator using switch with menu as: +
for addition, - for subtraction, * for multiplication, / for division and % for
modulus.
ii. Write a program to check the number is Armstrong number or not.

5. Write a program to perform multiplication of two matrix, the order must be


inputted by the user.
6. i. Write a program to check the number is prime or not.
ii. What is else if ladder write a program to explain it.

Module-3
7. i. Write a program in C to check number is Armstrong or not using function
with argument and with return.
ii. Write a program in C to find average of n array elements using function
with argument without return.
8. i. What is the difference between actual and formal argument?
ii. Write a program to swap two integer number using call by value and call by
address.
9. i. Write a program in C to reverse a string without using string functions.
ii. Write a program in C do string concatenation without using string function.
Module-4
10. i. What is structure and union in C. Describe the syntaxes and memory
representation with example.
ii. Write a program to find the sum of digits of a number.

11. WAP in C to store 15 records of students having name, rollno and 5 subjects.
marks, display the name, roll no and average marks using array within structure
and array of structure.
12. i. What is user defined data type, how we can create and use in the program,
explain.
ii. Find out the error and write correct code, if the program is not correct
otherwise leave it.
#include<stdio.h>
int main()
{
struct emp
{
char name[20];
int sal;
}
struct emp e[3],i=0;

for( i<3; i++)


{
scanf("%c %f", &e[i].name, &e[i].sal);
printf("\n %s %f", e[i].name, e[i].sal);
}

return 0;
}
Module-5
13. i. Explain different types of file mode.
ii. Explain the working principle of gets() and puts() with example.
14. What is storage class? Briefly explain different types of storage class in C.
15. Write a program to store n integer numbers in number.text file, read this
file, if the number is even store in even.text file and odd then store in
odd.text file. Then display all the files.

**All Questions in semester exam may not be confined within the given question bank.

You might also like