C Programming and Problem Solving
Questions 271 to 280
271.
|
What is
the output of the following code?
#
include<stdio.h>
int main()
{
int i=1;
printf(“%d %d %d” ,++i,i++,++i);
return (0);
}
|
||||||||||
272.
|
Which
escape character can be used to begin a new line in C?
|
||||||||||
273.
|
How many
actual arguments shall be used for a “normal function call” for each formal
argument?
|
||||||||||
274.
|
What is
the exact meaning of the following statement?
int
*p(char *a [])
|
||||||||||
275.
|
What is
the associativity of the conditional operator?
|
||||||||||
276.
|
What is a
difference between a declaration and a definition of a variable?
|
||||||||||
277.
|
What is
the output of the following program?
# include
<stdio.h>
int main()
{
int a=10, b=11, c=13, d;
d = (a=c, b+=a, c=a+b+c);
printf(“ %d”, d);
return(0);
}
|
||||||||||
278.
|
What is
the final value of a, if the initial values are b=20, c=21, d=15, a=1?
a =
d^b&c| b;
|
||||||||||
279.
|
Choose
the correct output for the following given program.
# include <stdio.h>
void fun(int a, int b, …)
{
int i=0, *p = &b;
for( printf(“ ”);
i++<a; )
printf(“%d, ”, ++(*p++));
}
int main()
{
fun(1, 0);
fun(4,5,6,7,8);
return(0);
}
|
||||||||||
280.
|
What is
the return value of the following function if the function is called as
int value =
fun(6);
int fun(int n)
{
if( n = = 1 ||
n = = 2) return
1;
else return( fun(n-1) + fun(n-2) );
}
|
Answers
271.
|
Answer : (d)
Reason: The last incremented i values is 4 so the values are displayed as
4 2 2.
|
272.
|
Answer : (b)
Reason: The escape character can be used to begin a new line in C is \n.
|
273.
|
Answer : (e)
Reason: In a normal function call, there will be one actual argument(s)
for each formal argument.
|
274.
|
Answer : (a)
Reason: p is a function that accepts an argument which is an array of
pointers to characters returns a pointer to an integer quantity.
|
275.
|
Answer : (b)
Reason: The associativity of the conditional operator is right to left.
|
276.
|
Answer : (a)
Reason: The difference between a declaration and a definition of a
variable is Both can occur multiple times, but a declaration must occur
first.
|
277.
|
Answer : (b)
Reason: Value 50 is assigned finally to d variable.
|
278.
|
Answer : (e)
Reason: Value 31 is assigned to
variable ‘a ‘after
performing all bitwise operations.
|
279.
|
Answer : (b)
Reason: Syntax error will be displayed as a result.
|
280.
|
Answer : (c)
Reason: Syntax error will be displayed as a result.
|
thank you.
ReplyDeletec++ tutorial
java tutorial
It Really Help Me A Lot, C Programming Is One Of The Core Languages And I Think These MCQ Will Surely Give Help To People Who Are Learning It!.
ReplyDelete