Skip to main content

Question bank of C language

1. Describe the basic features of a C language?
2. Discuss the programming style of a C language?
3. What is the role of semicolon in a C program?
4. What is the difference between a variable and a constant?
5. C language is said to be reach in data type. Discuss the various classes of data type available in C?
6. What do you understand by data qualifiers? What is the use of using such qualifiers?
7. What are the keywords used to define the following state with example?
1. Integral Data Type
2. Unsigned long integral data type
3. Floating point data type
4. signed character data type
5. signed short integral data type

8. What do you understand by ASCII value of a character? Can we use expressions including booth integral data type and character data type. Justify your answer.
9. What is escape sequence? When are these sequences required?
10. State whether following are true or false:
1. Every line of a C program must end with a Semicolon
2. C is not a case sensitive language
3. Every C program ends with a END word
4. main() is where program begins a execution
5. On one line in C program one can have only one statement
6. Closing braces of a C program signifies logical end of the program
7. Syntax error and logical errors are same.
8. Void is just a notation used with main ().
9. A printf statement can generate only one line of output.
10. Define and include are compiler directive statements.
11. What characters comprise C character set?
12. What are rules for naming identifiers? Can we include digits? Is lowercase equivalent to uppercase? How many characters can be included in an identifier name? Are all characters equally significant
13. What are keywords? What restrictions apply to their use?
14. What are 4 basic data types of C?
15. What are 4 basic data type qualifiers? To which data type each qualifier can be applied?
16. What are four basic types of constants in C
17. What rules applied to numeric-constants.
18. What rules apply to integer constants? How are decimal,octal, hexadecimal constants distinguished from each other.
19. What is the largest permissible magnitude of integer constant? State your answer in decimal, octal and hexadecimal
20. What is difference between signed, unsigned integer constants, long and short integer constants? How they differ from ordinary integers.
21. What are different ways in which floating point constants can be written? Discuss purpose of exponential in floating point constant
22. Discuss largest value at can be taken by floating point constant how is it different form integers
23. What is ASCII character set?
24. What is escape sequence? What is its purpose? Discuss standard and non standard escape sequences.
25. What is a string constant and how does it differ form character constants.


Control Structures in C

26. How does a expression statement differ from a compound statement? Explain with eg.
27. What is the purpose of if-else statement? What are the two different form of if-else statement? How do they differ? Explain with eg.
28. Describe the situation when Switch statement should be used? Describe the syntactic rules of using a Switch Statement.?
29. What do you understand by Case Label? What kind of expression can be used with a Case label?
30. What is the purpose of While loop? When is the logical expression evaluated? What is the minimum number of times a while loop can be executed?
31. How does do-while statement differ from while statement? Summarize the syntactic rules that need to be followed while using the two loops.
32. Explain FOR statement? How does it differ from the other looping statement?
33. What is the purpose of index in FOR statement? Can any of the three initial expression in the for statement be omitted? Explain with example
34. What rules apply to nesting of loops? Is it possible to embed one kind of loop in other discussed with example.
35. What is the use of default alternative in Switch statement?
36. Compare use of switch with nested if-else statement.
37. What is the purpose of break statement? With which control statement break can be used?
38. Consider a situation where break statement is used with innermost of several nested control statements. What happen when the break statement is executed?
39. What is the purpose of using a Continue statement Explain with example? With which control statement continue statement can be used?
40. What do you understand by a comma operator? With which control statement comma operator is used?
41. Consider situation when comma operator is used? While evaluating expression containing comma operator which operand will determine type and value of entire expression. Expalin with example.
42. What is precedence of comma operator as compared to other C operator?
43. What is the purpose of Goto statement?How the associated target statement can be identified?
44. Discuss the syntactic rules to be followed while using go to statement? Are there any restrictions that apply where control can be transferred in a C program Why the use of go to statement discouraged Explain with e.g.
45. Compare the syntax associated with statement label and case label.
46. Explain the output of following statement:

If (abs(z) < zmin ) ) z= (z>0)? Zmin:-zmin;
Can we use switch statement be used in this instance?


45. Explain all compound statement that appear in the following program:

{

sum = 0;
do
{
scanf(“%d”,&i);
if(i<0) { i=-I; ++fag; } sum=sum+I; } while (i!=0); 47. Using each of the following control statements perform the tasks written below 1. While statement 2. do-while statement 3. For statement a. Calculate sum of every third integer starting from i-3 for all values of i <100 b. Take value of i and n from the user and print the series i,i*n,i*2n,i*3n …… c. Write a loop that will take 10 characters from the user interactively and output their ascii value. 48. Write a switch statement that will examine the value of a integer value say flag and print one of the following messages depending on value of i 1. Hot, if flag has value 1 2. Warm, if flag has value 2 3. Cold, if flag has value 3 4. Out of range, if flag has any other value 49. Write an appropriate control structure that will take input Temp from the user and Print following messages depending on the value assigned to temp a. Ice, if value of temp is less than 0 b. Water, if value of temp lies between 0 and 100 c. Steam, if value of temp exceeds 100 50. Describe output generated by following C programs: 1. #include
main()
{
int i=0,x=0;

while (i<20) { if (i% 5==0) { x+=i; printf(“%d”,x); } ++i; } printf(“ = %d”,x); } 2. #include
main()
{
int i=0,x=0;

do {

if(i%5==0) {
x++;
printf(“%d”,x);
}

++i;

} while (i<20); printf(“ x= %d”,x); } 51. Identify error if any in the following declaration statements: 1. int count(100); 2. float value[5,15] 3. float avg[row],[column]; 4. char name[30]; 5. int sum[]; Identify error if any in following initialization statements? 52. Assume arrays a and b declared as follows: int a[5][4]; float b[4]; Find errors if any in the following program segment? a. for(i=1;i<=5;i++) for(j=1;j<=4;j++) a[i]][j]=0; b. for(i=1;i<4;i++) scanf(“%f”,b[i]); c. for(i=0;i<=4;i++) b[i] =b[i]+i; d. for(i=4;i>=0;i--)
for(j=0;j<4;j++) a[i][j] =[j] + 1.0; 53. Describe the array defined in each of the following statement a. char name[25]; b. flat d[5]; c. # define R 60 …………….. int a[R] d. int mat[5][5] e. # define A 60 # define B 60 …………………………… char Mem[A][B] f. double accounts[40][50][60]; Describe array defined in each of the following statements Float c[6] = { 2.0,5.0,3.0,-4.0,2.0,12.0,0.0,8.0}; Int b[6] ={ 2,4,5,6}; Int y[12] = {0,0,7,0,0,6}; Char flag[4] ={‘t’,’r’,’u’,y’} Char f[] = true; Int p[2][4] ={1,3,5,7}; Int f[2][4]={1,1,3,3,5,5,7,7}; Int g[2][4] = { { 1,3,5,7}, {2,4,6,8} }; k) int f[2][4] ={ {1,3}, {5,7} }; 54. In each of the following situations write definitions and declaration required to transfer the variables and arrays from main to a function called Trial. In each case assign the return value to a floating point variable f. a. Transfer 2 – floating point variable a,b and 1-dim, 10 –element array “Name“ to a function b. Transfer int var n,char var c and 1-dim 20 ele int array “N” values 55. What will be the output of the following program segments? a. main() { int a,b=0; int c[10] ={ 1,2,3,4,5,6,7,8,9,0} for(a=0;a<10;++a) if((c[a]%2)==0) b+=c[a]; printf(“%d”,b); } b. Main() { int a,b =0; int c[10]={1,2,3,4,5,6,7,8,9,0}; for(a=0;a<10:++a) b+=c[a]; pritf(“%d”,b); } 56. How does array differ from ordinary variable? How does their definition differ from that of an ordinary variable? 57. What are the conditions that need to satisfy by all the elements of an error? 58. How is individual element identified in array explained with eg? 59. What do you understand by subscript? What are the restrictions that are applicable to the values that can be assigned to the subscript? 60. “Array size can e specified using a symbolic constant” What is the advantage of using a symbolic constant? 61. What is the value automatically assigned to the array element that are not explicitly initialized? 62. What is the extra character added to the end of array when an array of unspecified length is assigned a value? 63. What are array declaration how they differ from array definitions? 64. How are array processing done in C. Explain with example? Can array be process with a single statement? 65. How array can be passed to function? Explain elaborating following points with Example: 66. How argument is written and how corresponding argument is written in the function? 67. How is array name written when it is passed to function? What do you understand by Dimensions of an array? How is a multi dimensional array defined? 68. What are the rules that define the order in which values are assigned to multi dimensional array elements? 69. How can be string represented by an array? 70. Discuss the following function giving example of their implementation 1. strcmp() 2. strlen() 3. strcpy() 71. What do you understand by Function? State three advantages of using Functions? 72. What do you mean by function call? From what part of the program can function be called? 73. What is the purpose of return statement? Does every function need to have an return Statement? 74. What are formal arguments? What are actual arguments? What is the relationship between formal and actual arguments? 75. What is the purpose of using void keyword? When is this keyword used? 76. Can a function be called from more than one place in a program? 77. What is function prototype? What is their purpose? Where with in a program are function protypes normally placed? 78. What are difference between passing an array to a function and passing single valued data item to a function? 79. What is recursion? What is advantage of using it? 80. Explain meaning of each of the following function prototypes a. int f(int a); b. double f(double a, int b) c. void f(long a .short b,unsigned c); d. char f(void); 81. Write appropriate function call for each of the statement: a. float form(float x) { float z; z= 3* x +1; return(z); } b. void displ(int a,int b) { int c; c=sqrt(a*a + b*b); printc(“c=%i”,c); } 82. Explain following statement: 1. Float f(float a,float b) 2. long f(long a) 3. void v(int a) 4. char v(void) 83. Suppose function f1 calls function f2. Does order of function definition make any difference? 84. What is a structure? How does a structure differ from an array? 85. What is a structure member? What is relationship between structure member and a structure. 86. Can a structure variable be defined as member of another structure? Explain with eg. 87. Can array be included as member of a structure? Explain with example. 88. How members of a structure are assigned initial values? Explain with example 89. How is array of structure initialized? 90. How can a structure member be accessed? Explain with example. 91. What is the precedence of a period (.) operator? What is its associativity? 92. Can period operator be used with array structure?Explain 93. How can size of a structure determined? 94. Define a structure that contains following three members: a. Integer quantity Age b. Float Height c. Float weight Include user –defined data type record with in definition 95. Define a structure that contains following two members: a. 40 element character array called name b. Mks in eng c. Mks in hindi d. Mks in maths Declare a array of 50 having this structure. 96. Describe the basic input/output functions? 97. What do you understand by control string in scanf function? Describe the elements of control string in detail 98. WAP to check whether given string is palindrome or not? 99. What do you understand by pre-processor staments? Explain them in detail? 100. What is a compiler? What is its role in any programming language? 101. Write appropriate array definition for each of the following problem situations: 1. Define a 1- dim array,10 element array named numbers assign values to them at the time of declaration 2. Define 1-dim array called direction. Assign the string “south” to it and end the string with a null character. 3. Define 2-dim 3X4 integer array called n. Assign value to the following array element 10 12 14 16 20 24 26 28 30 32 34 36

Comments

dot net said…
thanku mam

Popular posts from this blog

Advantages and Disadvantages of EIS Advantages of EIS Easy for upper-level executives to use, extensive computer experience is not required in operations Provides timely delivery of company summary information Information that is provided is better understood Filters data for management Improves to tracking information Offers efficiency to decision makers Disadvantages of EIS System dependent Limited functionality, by design Information overload for some managers Benefits hard to quantify High implementation costs System may become slow, large, and hard to manage Need good internal processes for data management May lead to less reliable and less secure data

Inter-Organizational Value Chain

The value chain of   a company is part of over all value chain. The over all competitive advantage of an organization is not just dependent on the quality and efficiency of the company and quality of products but also upon the that of its suppliers and wholesalers and retailers it may use. The analysis of overall supply chain is called the value system. Different parts of the value chain 1.  Supplier     2.  Firm       3.   Channel 4 .   Buyer

Big-M Method and Two-Phase Method

Big-M Method The Big-M method of handling instances with artificial  variables is the “commonsense approach”. Essentially, the notion is to make the artificial variables, through their coefficients in the objective function, so costly or unprofitable that any feasible solution to the real problem would be preferred, unless the original instance possessed no feasible solutions at all. But this means that we need to assign, in the objective function, coefficients to the artificial variables that are either very small (maximization problem) or very large (minimization problem); whatever this value,let us call it Big M . In fact, this notion is an old trick in optimization in general; we  simply associate a penalty value with variables that we do not want to be part of an ultimate solution(unless such an outcome is unavoidable). Indeed, the penalty is so costly that unless any of the  respective variables' inclusion is warranted algorithmically, such variables will ...