A static variable
What will be the output of the program?
#include
#define SWAP(a, b) int t; t=a, a=b, b=t;
int main()
{
int a=10, b=12;
SWAP(a, b);
printf("a = %d, b = %d\n", a, b);
return 0;
}
What is a preprocessor directive
How many bytes of memory will the following code reserve?
#include
#include
int main()
{
int *p;
p = (int *)malloc(256 * 256);
if(p == NULL)
printf("Allocation failed");
return 0;
}
Which header file should be included to use functions like malloc() and calloc()?
Local variables are stored in an area called ___________
The information about an array used in a program will be sorted in
Minimun number of comparison required to compute the largest and second largest element in array is
Consider the following pseudocode:
x:=1;
i:=1;
while (x ≤ 500)
begin
x:=2x ;
i:=i+1;
end
What is the value of i at the end of the pseudocode?
What will be the output of the program?
#include
int main()
{
int i;
char c;
for(i=1; i<=5; i++)
{
scanf("%c", &c); /* given input is 'a' */
printf("%c", c);
ungetc(c, stdin);
}
return 0;
}
Which of the given function differs from the statement’errno is not neccessarily set on conversion error’?
What will be the output of the following C code?
void main()
{
div_t res;
res = div(34, 4);
printf("quotient part = %d\n", res.quot);
printf("remainder part = %d\n", res.rem);
}
Consider the given statement:
int x = 10 ^ 2
What will be the value of x?
What will be the output of the program?
#include
int main()
{
printf("%d %d\n", 32<<1>>1, 32>>0);
printf("%d %d\n", 32>>-1, 32>>-0);
return 0;
}
A program is a sequence of ________________ written in a programming language.
Which is an indirection operator among the following?
What will be the output of the program ?
#include
int main()
{
char *str;
str = "%d\n";
str++;
str++;
printf(str-2, 300);
return 0;
}
Which of the following function declaration is illegal?
In case of a conflict between the names of a local and global variable what happens?
Comment on the output of this C code?
int main()
{
int i, n, a = 4;
scanf("%d", &n);
for (i = 0; i < n> a = a * 2;
}
Total number of questions : 20
Number of answered questions : 0
Number of unanswered questions : 20
A static variable
Your Answer : (Not Answered)
Correct Answer : C
No answer description available for this question.
What will be the output of the program?
#include
#define SWAP(a, b) int t; t=a, a=b, b=t;
int main()
{
int a=10, b=12;
SWAP(a, b);
printf("a = %d, b = %d\n", a, b);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
What is a preprocessor directive
Your Answer : (Not Answered)
Correct Answer : C
preprocessor directive is a message from programmer to the preprocessor.
How many bytes of memory will the following code reserve?
#include
#include
int main()
{
int *p;
p = (int *)malloc(256 * 256);
if(p == NULL)
printf("Allocation failed");
return 0;
}
Your Answer : (Not Answered)
Correct Answer : B
Hence 256*256 = 65536 is passed to malloc() function which can allocate upto 65535. So the memory allocation will be failed in 16 bit platform (Turbo C in DOS).
If you compile the same program in 32 bit platform like Linux (GCC Compiler) it may allocate the required memory
Which header file should be included to use functions like malloc() and calloc()?
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question
Local variables are stored in an area called ___________
Your Answer : (Not Answered)
Correct Answer : D
Local variables are stored in an area called stack. Global variables, static variables and program instructions are stored in the permanent storage area. The memory space between these two regions is known a heap.
The information about an array used in a program will be sorted in
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
Minimun number of comparison required to compute the largest and second largest element in array is
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
Consider the following pseudocode:
x:=1;
i:=1;
while (x ≤ 500)
begin
x:=2x ;
i:=i+1;
end
What is the value of i at the end of the pseudocode?
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
What will be the output of the program?
#include
int main()
{
int i;
char c;
for(i=1; i<=5; i++)
{
scanf("%c", &c); /* given input is 'a' */
printf("%c", c);
ungetc(c, stdin);
}
return 0;
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
Which of the given function differs from the statement’errno is not neccessarily set on conversion error’?
Your Answer : (Not Answered)
Correct Answer : D
The function atoi() and atol() are similar to strtol(), atof() is similar to strtod() except that errono is not necessarily set on conversion error.
What will be the output of the following C code?
void main()
{
div_t res;
res = div(34, 4);
printf("quotient part = %d\n", res.quot);
printf("remainder part = %d\n", res.rem);
}
Your Answer : (Not Answered)
Correct Answer : B
div_t div(int n, int d) used to divide n (numerator) by d (denominator). div_t is a structure defined in
int quot;
in rem;
Consider the given statement:
int x = 10 ^ 2
What will be the value of x?
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
What will be the output of the program?
#include
int main()
{
printf("%d %d\n", 32<<1>>1, 32>>0);
printf("%d %d\n", 32>>-1, 32>>-0);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
A program is a sequence of ________________ written in a programming language.
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
Which is an indirection operator among the following?
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
What will be the output of the program ?
#include
int main()
{
char *str;
str = "%d\n";
str++;
str++;
printf(str-2, 300);
return 0;
}
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
Which of the following function declaration is illegal?
Your Answer : (Not Answered)
Correct Answer : D
No answer description available for this question.
In case of a conflict between the names of a local and global variable what happens?
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
Comment on the output of this C code?
int main()
{
int i, n, a = 4;
scanf("%d", &n);
for (i = 0; i < n> a = a * 2;
}
Your Answer : (Not Answered)
Correct Answer : B
No answer description available for this question.
Total number of questions : 20
Number of answered questions : 0
Number of unanswered questions : 20
We'll write only best content for you