Wednesday, February 14, 2007

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 below1. While statement2. do-while statement3. For statementa. Calculate sum of every third integer starting from i-3 for all values of i <100b. Take value of i and n from the user and print the seriesi,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 i1. Hot, if flag has value 12. Warm, if flag has value 23. Cold, if flag has value 34. Out of range, if flag has any other value49. Write an appropriate control structure that will take input Temp from the user and Print following messages depending on the value assigned to tempa. Ice, if value of temp is less than 0b. Water, if value of temp lies between 0 and 100c. Steam, if value of temp exceeds 10050. 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

Monday, November 20, 2006

Introduction of "lecture-Notes and Tutorials"

This blog contains information regarding various computer courses student may study during their study curriculum. Idea is to post lecture notes,question banks,tips on subject about which I can talk n this blog. This will definately provide guidance about subject. I am starting with question bank of Simulation & Modeling and Automata Theory and will keep on posting Lecture notes,tips in the latter posts.

Thursday, November 16, 2006

Brief discussion about Differential Equation models and their Simulator

  1. Describe the working of a Simple harmonic oscillator?What do u understand by Damping factor?Describe the driving force which makes the oscillator oscillate?And also give reasons for dampening of the motion of the oscillator?
  2. What is the difference b/w Discrete and Linear oscillator?Stress upon the difference in working mechanism of the oscillators.
  3. Discuss Lotka-Volterra Model
  4. Discuss Rossler’s Attractor?
  5. What do u understand by Stability problems? Also, discuss various sources of error that can occur in a System?
  6. What do u understand by positive and negative feedbacks in a Feedback loop?
  7. What do u understand by exponential delay of first order? Discuss factor that is responsible for dampening of such a system?
  8. Discuss feedback loop in a Continuous System?
  9. Compare the cyclic behavior of the Rossler,Vanderpol, and second linear oscillator
  10. Explain how the effect of a state transition may not only be to schedule new events , but also to cancel events that were scheduled in the part.
  11. State and Explain DTSS.

Tuesday, November 14, 2006

Discussing Cellular Automata in detail

  1. What is Cellular Automata?Waht is its use?How is it different from switching automata?Explain.
  2. What is use of Cellular Automata for discrete time models and their simulation?Explain
  3. Write a Simulator for one–dimensional cellular automata. Compare the direct approach that scans cell all the time with the discrete event approach in terms of execution time.
  4. Compare the cyclic behavior of the Rossler,Vanderpol, and second linear oscillator

Saturday, November 11, 2006

Understanding Input Output behavior of a System

  1. What do you understand by I/O behavior of a System?
  2. Discuss the usage I/O function in functionality of any system? Give examples.

  3. What do you understand by State transition? Also discuss briefly formulation of a trajectory in any system


  4. Explain the concept of segment and trajectories. Provide a pictorial representation of Input ,output ,state trajectories explaining how these trajectories change with time base.

  5. Segments of a system can be differentiated into different categories.
  6. Discuss various kind of segments explaining their application.


  7. What do u understand by Observation frame? When is it used state with example?


Friday, November 10, 2006

Simulation & Modeling Question Bank (continued)

  1. Explain what is meant by Model Validation?How do you validate models in
    practice ?What are the major sources of error in validation?
  2. What are different type of Models?Explain their general characterstics?
  3. Explain the Monte-Carlo Simulation Technique.
  4. Explain Poisson Distribution Technique?
  5. What do you understand by Verification and Validation of simulation model?

Thursday, November 9, 2006

Simulation and Modeling Question bank

In this post I have listed elementary questions that are related to basics of S&M.

  1. Sketch and explain Basic System specification formalisms
  2. Define the terms ‘System’ & ‘Model’. Also discuss various types of System and Models. Describe the various criteria of classification of systems and models. Illustrate with abundant examples.
  3. Discuss modeling relation and validity
  4. The inescapable fact about modeling is that it is severely constrained by complexity limitations’. Explain.
  5. What do you understand by Hierarchy of System Specification? Why is it required Explain?
  6. Discuss various levels of System Knowledge?
  7. What are the fundamental system problems that any system has to face?
  8. What do you understand by Object oriented paradigm? How can you relate it with System theory?
  9. Discuss briefly evolution of System Formalism? Discuss various forms of System formalisms? Can they be used together? State with help of some examples?
  10. Name and Explain different levels of system knowledge?
  11. Define Time Base. How behaviors occur over time?

  12. What do you understand by Coupling of systems? How advantageous is this? What are the parameters we need to keep in mind while coupling two systems.


  13. What do you mean by quantized systems? Explain


  14. Describe different entities of the framework for modeling and system simulation. Are these entities related to each other? Explain.




Referrals:

Modeling and Simulation by Zeigler
Simulation Modeling and Analysis by Averill M.Law,W. David Kelton