Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
QUESTION BANK
UNIT I
Short Questions
Generation and Classification of Computers- Basic Organization of a
Computer
1) List the four parts of a complete computer system.
(i) Hardware (ii) software (iii) data (iv) users
2) What are the advantages and disadvantages of I generation computers?
Advantages: These were the fastest at their time. They were able to execute
complex calculations in an efficient manner.
Disadvantages: operations depended on machine language. Therefore, they
are not very easy to program. They were not flexible for many different
application. They were bulky and produced lot of heat.
3) Give the advantages and disadvantages of II generation computers.
Advantage: they were the fastest at that time. Used assembly language so
programming was easier. They could be transported from one place to other.
Disadvantages: They were required to be placed in air-conditioned rooms.
The cost of these computers were so high that home users cannot afford to
buy. They were only special purpose computers and so, they can not be used
for general purpose applications.
4) Give the advantages and disadvantages of III generation computers.
Advantages: fastest at their time. Computational time was greatly reduced
and thus very productive. There were easily transportable. They could be
installed easily and occupied less space. They were used both business and
scientific application and thus there were considered general purpose
computers.
Disadvantages: storage capacity was not high. Overall cost was high. They
were still to be placed in air-conditioned rooms.
5) Give the advantages and disadvantages of IV generation computers.
Advantages: The use of VLSI technology made these computers powerful in
speed and accuracy. Storage capacity was very high. They were highly
reliable and required less maintenance. They were highly user friendly.
Programs used were highly portable to different computers and they are very
versatile. They require less power to operate.
Disadvantage: very complicated mechanism is needed to assemble these
computers. Working on these computers depends on the instructions given by
the programmer.
1
55)
56)
57)
58)
59)
60)
2)
3)
4)
6)
7)
8)
6
12
12)
13)
14)
15)
16)
9)
10)
11)
17)
18)
19)
20)
21)
22)
23)
24)
10
8
8
4
5
6
5
3
6
8
8
6
11
8
5
8
5
8
6
8
8
8
6
8
4)
5)
6)
7)
8)
9)
the closing brace (}). Between these two braces the program should
declare the declaration and executable part
What is meant by compilation? Explain in detail.
The source program statements should be translated to object programs
which is suitable for execution by the computer. The translation is done
after correcting every statement. If there is no error, the compilation
proceeds and translated program are stored in another file with same file
name with extension .obj. if any errors are there, the programmer
should correct them. Linking is also an essential process. It puts all other
program file and functions together that are required by the program.
Briefly explain the functions of a linker.
After the program has been translated into object code, it is ready to be
linked. This process is once again performed automatically whenever the
cc or gcc command is issued under Unix. The purpose of the linking
phase is to get the program into a final form for execution on the
computer. If the program uses other programs that were previously
processed by the compiler, then during this phase the programs are linked
together. Programs that are used from the systems program library are
also searched and linked together with the object program during this
phase. These are the functions of the linker.
What are the different standard data types?
There are only four standard data type available in C.
char specifies a character variable
int specifies an integer variable
float specifies a floating-point variable
void associates function returning no value
What are the differences between signed and unsigned data types?
Signed integer
Unsigned integer
Signed integer occupies 2 bytes
in memory
Range : -32,768 to 32,767
Format specifier is %d or %i
By default signed int is short
13
Size(byte)
1
1
2
2
4
4
8
Program
#include <stdio.h>
#include <conio.h>
main()
{
int a,b,c,d;
clrscr();
printf(%5d\n,0);
printf(%6d\n,101);
printf(%7d,21012);
getch();
}
Output
0
101
21012
8
8
4
6
8
5
6
16
8
8
here, first printf will correspond to printing the base address of the array
under consideration and its value which is 1.
23
size_t strlen(cs)
char *strcpy(s,ct)
3) Explain the need for array variables. With respect to arrays, describe 8
the following: declaration of arrays, Two-dimensional array and
accessing an array element
4) Write a C program to find the largest and the smallest number in a
given array
UNIT IV
Part A Questions and answers
Function definition of function Declaration of function, pass by value, pass
by reference
1) Write the definition of a function. Indicate the types of functions
available in C.
data-type name(type-1 arg-1, type-2 arg-2, , type-n arg-n)
4) How does a function work? Explain how arguments are passed and
results are returned?
Once a function is defined and called, it takes some data from the calling
function and returns a value to the called function.
The detail of inner working of function is unknown to the rest of the
program. Whenever a function is called, control passes to the called
function and the working of the calling function is stopped. When the
execution of the called function is completed, control returns back to the
calling function and executes the next statement.
The values of the actual arguments passed by the calling function are
received by the formal arguments of the called function. The number and
type of the actual and formal arguments must be the same. Any
mismatch will produce unexpected result.
The function operates on formal arguments and sends back the result to
the calling function. The return() statement performs this task.
5) List any five-library functions and illustrate them with suitable examples.
28
The above is the proto type for power function where the first argument
is raised to second power. That is xy where x is first and y is second
argument.
z = pow(4.0,5.0);
13)
14)
15)
16)
Yes.
17) Can we define a user-defined function with the same library function
name?
No; but if the header file is not included for the particular program, the
function name will not conflict so it is allowed only in such occasion.
18) List and explain the four scope of variables in brief.
Automatic variables(local variables), External variables, Static variables
30
the output is
The value 1 is stored at address 9364.
The value 1 is stored at address 9364.
after execution.
32
ptr = zilch;
while (*ptr != 0.0)
{
printf("The value stored at address %u is %f\n",ptr,*ptr);
ptr++;
}
}
The output would be
The value stored at address 4144 is 1.230000
The value stored at address 4148 is 2.340000
The value stored at address 4152 is 3.450000
The value stored at address 4156 is 4.560000
The value stored at address 4160 is 5.670000
Note the intervals between the address now. They are each 4. Our
references computer addresses its memory byte by byte, and an int
takes up two bytes where as a float uses four. The same case applies to
operator as well.
27) Explain the relation between an array and a pointer.
Consider the declarion:
int prime[4]={2,3,5,7},*ap;
Here prime[0] refers to 2 prime[1] refers to 3 and so on. But simply, prime
will mean a pointer to the number 2 in the above declaration. By having an
assignment as
33
5)
6)
7)
8)
6
6
6
8
8
8
10
name[30]
rollno
height
struct studnt1 student;
The above declaration creates variables studnt1 of structure type
student and it reserves a total of 36 bytes(30 for the name[30], 2
bytes for the rollno which is an integer and 4 bytes for float
height)
dob
dd
mm
yyyy
doj
dd
mm
yyyy
4)What are aggregate types?
The structure is a kind of aggregate data type in C which is nothing but a
derived data type.
5) Can a structure have a pointer to itself?
Consider the following declaration for a node in a binary tree. Let us say the
node has a value which is of type integer and as it is a binary tree a node may
have two pointers pointing to two other nodes. This can be represented as:
struct *node
{
int value;
struct node *child1,*child2;
}
6) How is the declaration struct type{...}; different from typedef struct {...};?
By using typedef we can create new data type. The statement typedef
37
Compiler
Translation
Loading
10)What is a macro? What are object like macros and function like macros?
Preprocessor directives such as # define are used at the beginning of the C
program to define constants or any macro substitution.
#define <identifier> <replacement token list>
// The above one is an object-like macro
#define <identifier>(<parameter list>) <replacement token list>
1)
2)
3)
4)
5)
6)
7)
8)
40
6
6
6
6
6
8
16
2.
3.
4.
What is a protocol?
5.
What is a pseudocode?
6.
Define: algorithm.
7.
(8).
9.
11.
a)
i)
(8)
ii)
(8)
(OR)
b)
12.
a)
(16)
Explain the basic organisation of computer with suitable block
diagram.
Explain the steps of software developments with suitable examples. (16)
(OR)
b)
i)
ii)
13.
a)
i)
ii)
(8)
(8)
(8)
(8)
(OR)
14.
b)
i)
(16)
a)
i)
(8)
ii)
(8)
(OR)
b)
i)
(4)
ii)
(4)
42
15.
(8)
(16)
(OR)
b)
i)
ii)
43
(4)
(4)
(8)
Reg. No:
2.
3.
4.
5.
What is an algorithm?
6.
7.
8.
9.
What is an array?
a)
i)
(10)
(6)
(OR)
b)
12
a)
(10)
i)
ii)
i)
Convert the decimal number 698.125 into the binary and octal (6)
equivalent.
(10)
Explain about the types of software.
ii)
(6)
(OR)
b)
13
a)
i)
(10)
ii)
(6)
i)
(10)
ii)
(6)
(OR)
b)
14
a)
i)
(16)
ii)
i)
(8)
ii)
(8)
(OR)
b)
i)
(8)
15
a)
b)
46
(8)
(8)
2.
List some of the key hardware and software technologies of fifth generation
computers.
3.
How will you convert a binary number to a gray code? What is the gray code
equivalent of 110011?
4.
5.
6.
7.
8.
9.
State any twe-library functions for string handling and their purpose.
47
a)
(16)
b)
i)
(5)
ii)
12
a)
(3)
i)
(8)
ii)
13
(5)
b)
(3)
(8)
(16)
a)
Discuss about:
(1) Electronic Mail
(2) HTTP
(3) FTP
(4) Usenet
Discuss about algorithm, flowchart and pseudo code and elaborate
their role while writing a program. Write an algorithm, draw a
flowchart and write pseudoco for the problem of generating the
triangular number sequence. 1,3,6,10,15,21,28,36,45,...[Given the
value of the nth term = n*(n+1)/2]
(OR)
b)
i)
(16)
(8)
a)
b)
Discuss about the need and different types of branching statements (8)
in C. Illustrate through. examples
Differentiate between the following concepts andI give example for each.
15
a)
(8)
.
i)
(8)
(8)
(OR)
b)
i)
-----------
49
(4)
(12)
3.
4.
5.
Define array.
6.
7.
8.
9.
10.
11.
a)
(16)
12.
13.
14.
b)
a)
Write about the need and types of looping statements in C language (16)
and discuss with examples.
(OR)
b)
(16)
ii)
(8)
a)
b)
a)
(16)
(8)
(16)
i)
Function declaration
(8)
ii)
(8)
(OR)
b)
i)
(10)
for each.
15
a)
(6)
i)
(8)
(8)
(OR)
b)
16
2.
52
4.
5.
6.
size_t strlen(cs)
char *strcpy(s,ct)
7.
char.
Define Recursion.
8.
The above example shows the call by value which will not serve our purpose of
exchanging. The way to obtain the desired effect is for the calling program to
pass pointers to the values to be changed. Since the operator & produces the
address of a variable, &a is a pointer to a. In swap itself, the parameters are
declared as pointers, and the operands are accessed indirectly through them.
9.
a)
i)
(10)
(6)
(OR)
b)
12
.
a)
(10)
(ii) Draw a flow chart to find sum first 100 natural numbers.
(6)
(8)
(OR)
55
(8)
13
a)
i)
(8)
ii)
(8)
(8)
i)
.
ii)
b)
i)
ii)
14
a)
(8)
(8)
(16)
(OR)
b)
15
(8)
a)
(8)
(16)
(OR)
b)
56
16