C Programming and Problem Solving
Questions 61 to 70
61.
|
Arrays
are passed as the arguments to a function by
(a) Value (b)
Reference (c) Constant value
(d) Can’t be passed
(e) Both a & b.
|
62.
|
Which of
the following statements are true after execution of the program.
int a[10], i, *p;
a[0] = 1;
a[1] = 2;
p = a;
(*p)++;
(a) a[1] = 3 (b) a[0] = 2 (c) a[1] = 2 (d)
compilation error (e) a[0] = 3.
|
63.
|
It is
necessary to declare the type of the function in the calling program if
(a) The function returns an integer
(b) Function returning only the float values
(c) The function is not defined in the same
file
(d) The function returns a non- integer value
(e) The size of the function is vary big.
|
64.
|
The
recursive functions are executed in a
(a) Parallel order (b) First In First Out order
(c) Last In First Out order (d) Iterative order (e) Random order.
|
65.
|
A static
variable is one
(a) Which can not be initialized
(b) Which is initialized once at the commencement
of execution and can’t be changed during the run time
(c) Can’t be declared as global, but as a local
only
(d) Which is same as the auto variable but is
placed at the head of the program
(e) Retains its value throughout the life of
the program.
|
66.
|
Consider
the following program fragment, and choose the correct one
main( )
{
int a, b = 2, c;
a = 2 * (b++);
c = 2 * (++b);
}
(a) a = 4,
c = 8 (b) a = 3,
c = 8 (c) b = 3,
c = 6 (d) a = 4,
c = 6 (e) b = 4, c = 6.
|
67.
|
What will
be the value of sum after the following program is executed?
main( )
{
int sum = 1, index = 9;
do {
index = index – 1;
sum *= 2;
}while( index > 9 );
}
(a) 1 (b) 2 (c) 9 (d) 0.5 (e) 0.25.
|
68.
|
What is
the right choice, if the following loop is implemented
{
int num = 0;
do {
--num;
printf( “ %d ”, num);
}while( ++num >= 0 );
}
(a) A run time error will be generated
(b) The program will not enter into the loop
(c) There will be a compilation error reported
(d) The loop will run infinitely many times
(e) Prints the value of 0 one time only.
|
69.
|
What is
the final value of the digit?
main( )
{
int digit = 0;
for ( ; digit
<= 9; )
printf( “%d\n”,
digit++);
digit *= 2;
--digit;
}
(a) Error (b) -1 (c) 17 (d) 16 (e) 19.
|
70.
|
If
the following code is executed then what is the value of the variable HI?
main( )
{
int HI, L, B;
L = B = 2;
HI = ( L == B ) ? 1 : 0;
}
(a) 0 (b) 2 (c) 1
(d) Run time Error (e) Compile time error.
|
Answers
61.
|
Answer : (b)
|
62.
|
Answer : (a)
Reason : As p is a pointer to the array a, any
operation performed on p effects array a also, and hence (*p++
|
63.
|
Answer : (d)
Reason : According to the definition of functions.
|
64.
|
Answer : (c)
Reason : Because for each function call an entry is
created in stack frame( known as Active Record Instance), and are executed in
LIFO manner.
|
65.
|
Answer : (e)
Reason : According to the definition of static
variable
|
66.
|
Answer : (a)
Reason : Because of post increment and pre increment
of operators
|
67.
|
Answer : (b)
Reason : As the loop is terminated after 1st
iteration ( index = index – 1 causes
it to be 8 )
|
68.
|
Answer : (d)
Reason : As the value of num is decremented(--num) and
again incremented(++num) and hence no change in num and remains 0 only
causing infinite loop.
|
69.
|
Answer : (e)
Reason : For 10 iterations digit becomes 20, but the
last statement ( --digit ) causes this to be 19 only
|
70.
|
Answer : (c)
Reason : Because of the ternary operator
|
Beginners Lab Assignments
ReplyDeletethank you.
ReplyDeletec++ tutorial
java tutorial
College Essay Writer Service
ReplyDeleteFirst, figure out what problem your software is supposed to answer, particularly if it's for someone else. You can come up with some extremely creative and inventive ideas, but if they don't address the issue, they're pointless. Inquire intelligently about what the programme should do in various circumstances and edge cases.
After then, break it down into smaller pieces (layers, modules, functions). Ensure that each chunk has 'high coherence,' meaning that every element of it deals with related topics.
As far as possible, keep the interface between layers or modules clear and uncomplicated.
Iterate through the design, development, and testing phases.
Last but not least, programming is about abstraction. Keep the how separate from the what. Find appropriate abstractions to get your coding language (C) closer to the issue domain.