Que.1. If the size of integer is 4bytes, What will be the output of the program?
#include<stdio.h>
int main()
{
int arr[] = {12, 13,14,15,16};
printf("%d, %d, %d",sizeof (arr),sizeof(*arr),sizeof(arr[0]));
return 0;
}
A: 16, 2, 2
B: 20, 2, 2
C: j=s;
D: *j=s;
Right Answer: B
Que.2. Are the following two statement same?
1.a <= 20 ? (b = 30): (c = 30);
2.(a <=20) ? b : (c = 30);
A: Yes
B: No
C: True
D: False
Right Answer: B
Que.4. What will be the output of the program ?
#include<stdio.h>
int main()
{
int i;
char a[] ="";
if(printf("%s", a))
printf("The string is empty");
else
printf("The string is not empty");
return 0 ;
}
A: No output
B: 0
C: 1022 Hello2
D: Hello1 1022
Right Answer: B
Que.5. What will be the output of the program?
#include<stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d", w, x, y, z);
return 0;
}
A: 1, 1, 1, 1
B: 1, 1, 0, 1
C: 1, 0, 0, 1
D: 1, 0, 1, 1
Right Answer: D
Que.6. Can I increase the size of dynamically allocated array?
A: No
B: cmp - is a pointer to an void function type.
C: cmp - is a void type pointer function.
D: cmp - is a function that return a void pointer.
Right Answer: A
Que.7. Will the following program print the message infinite number of times?
#include<stdio.h>
#define INFINITELOOP while(1)
int main()
{
INFINITELOOP
printf("HelloWorld" );
return 0;
}
A: Yes
B: No
C: 10
D: 20
Right Answer: A
Que.8. In the following program add a statement in the function
fact()such that the factorial gets stored in j
#include<stdio.h>
void fact( int*);
int main()
{
int i= 5;
fact(&i);
printf("%d", i);
return 0;
}
void fact(int *j)
{
static int s=1;
if(*j!=0)
{
s = s**j;
*j = *j-1;
fact(j);
/* Add a statement here */
}
}
A: *j=&s;
B: &j=s;
C: 65486, 65488
D: 65486, 65486
Right Answer: B
Que.9. What will be the output of the program ?
#include<stdio.h>
int *check(static int,static int);
int main()
{
int *c;
c = check(10,20);
printf("%d", c);
return 0;
}
int *check( static int i, static int j)
{
int *p, *q;
p = &i;
q = &j;
if(i >= 45)
return (p);
else
return (q);
}
A: Error: Non portable pointer conversion
B: Error: cannot use static for function parameters
C: 10, 2, 4
D: 20, 4, 4
Right Answer: D
Que.10. What will be the output of the program if the array begins at address 65486?
#include<stdio.h>
int main()
{
int arr[] = {12,14,15,23,45};
printf("%u, %u", arr, &arr);
return 0 ;
}
A: 65486, 65490
B: 65486, 65487
C: The string is empty
D: The string is not empty
Right Answer: B
Que.11. What will be the output of the program?
#include<stdio.h>
typedef struct error {
int warning, err, exception;
} ERROR;
int main()
{
ERROR e;
e.err=1;
printf("%d", e.err);
return 0;
}
A: strnchar()
B: strchar()
C: strrchar()
D: strrchr()
Right Answer: B
Que.13. If the different command line arguments are supplied at different times would the output of the following program change?
#include<stdio.h>
int main(int argc, char **argv)
{
printf("%d", argv[argc]);
return 0;
}
A: 10
B: 11
C: No output
D: Error: ++needs a value
Right Answer: B
Que.14. What will be the output of the program ?
#include<stdio.h>
int main()
{
char *str;
str = "%d";
str++;
str++;
printf(str- 2,300);
return 0;
}
A: Yes
B: No
C: 65474, 65476
D: 65480, 65496
Right Answer: D
Que.16. How many times "HelloWorld" is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<= 10; x++)
{
if(x <5)
continue;
else
break;
printf("HelloWorld");
}
return 0;
}
A: Infinite times
B: 11 times
C: 0 times
D: 10 times
Right Answer: C
Que.17. Macros have a local scope.
A: No output
B: 30
C: 3
D: 300
Right Answer: B
Que.18. What will be the output of the program?
#include<stdio.h>
int addmult(int ii,int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d, %d", k, l);
return 0;
}
A: 12, 12
B: 7, 7
C: 7, 12
D: 12, 7
Right Answer: A
#include<stdio.h>
int main()
{
int arr[] = {12, 13,14,15,16};
printf("%d, %d, %d",sizeof (arr),sizeof(*arr),sizeof(arr[0]));
return 0;
}
A: 16, 2, 2
B: 20, 2, 2
C: j=s;
D: *j=s;
Right Answer: B
Que.2. Are the following two statement same?
1.a <= 20 ? (b = 30): (c = 30);
2.(a <=20) ? b : (c = 30);
A: Yes
B: No
C: True
D: False
Right Answer: B
Que.4. What will be the output of the program ?
#include<stdio.h>
int main()
{
int i;
char a[] ="";
if(printf("%s", a))
printf("The string is empty");
else
printf("The string is not empty");
return 0 ;
}
A: No output
B: 0
C: 1022 Hello2
D: Hello1 1022
Right Answer: B
Que.5. What will be the output of the program?
#include<stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d", w, x, y, z);
return 0;
}
A: 1, 1, 1, 1
B: 1, 1, 0, 1
C: 1, 0, 0, 1
D: 1, 0, 1, 1
Right Answer: D
Que.6. Can I increase the size of dynamically allocated array?
A: No
B: cmp - is a pointer to an void function type.
C: cmp - is a void type pointer function.
D: cmp - is a function that return a void pointer.
Right Answer: A
Que.7. Will the following program print the message infinite number of times?
#include<stdio.h>
#define INFINITELOOP while(1)
int main()
{
INFINITELOOP
printf("HelloWorld" );
return 0;
}
A: Yes
B: No
C: 10
D: 20
Right Answer: A
Que.8. In the following program add a statement in the function
fact()such that the factorial gets stored in j
#include<stdio.h>
void fact( int*);
int main()
{
int i= 5;
fact(&i);
printf("%d", i);
return 0;
}
void fact(int *j)
{
static int s=1;
if(*j!=0)
{
s = s**j;
*j = *j-1;
fact(j);
/* Add a statement here */
}
}
A: *j=&s;
B: &j=s;
C: 65486, 65488
D: 65486, 65486
Right Answer: B
Que.9. What will be the output of the program ?
#include<stdio.h>
int *check(static int,static int);
int main()
{
int *c;
c = check(10,20);
printf("%d", c);
return 0;
}
int *check( static int i, static int j)
{
int *p, *q;
p = &i;
q = &j;
if(i >= 45)
return (p);
else
return (q);
}
A: Error: Non portable pointer conversion
B: Error: cannot use static for function parameters
C: 10, 2, 4
D: 20, 4, 4
Right Answer: D
Que.10. What will be the output of the program if the array begins at address 65486?
#include<stdio.h>
int main()
{
int arr[] = {12,14,15,23,45};
printf("%u, %u", arr, &arr);
return 0 ;
}
A: 65486, 65490
B: 65486, 65487
C: The string is empty
D: The string is not empty
Right Answer: B
Que.11. What will be the output of the program?
#include<stdio.h>
typedef struct error {
int warning, err, exception;
} ERROR;
int main()
{
ERROR e;
e.err=1;
printf("%d", e.err);
return 0;
}
A: strnchar()
B: strchar()
C: strrchar()
D: strrchr()
Right Answer: B
Que.13. If the different command line arguments are supplied at different times would the output of the following program change?
#include<stdio.h>
int main(int argc, char **argv)
{
printf("%d", argv[argc]);
return 0;
}
A: 10
B: 11
C: No output
D: Error: ++needs a value
Right Answer: B
Que.14. What will be the output of the program ?
#include<stdio.h>
int main()
{
char *str;
str = "%d";
str++;
str++;
printf(str- 2,300);
return 0;
}
A: Yes
B: No
C: 65474, 65476
D: 65480, 65496
Right Answer: D
Que.16. How many times "HelloWorld" is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<= 10; x++)
{
if(x <5)
continue;
else
break;
printf("HelloWorld");
}
return 0;
}
A: Infinite times
B: 11 times
C: 0 times
D: 10 times
Right Answer: C
Que.17. Macros have a local scope.
A: No output
B: 30
C: 3
D: 300
Right Answer: B
Que.18. What will be the output of the program?
#include<stdio.h>
int addmult(int ii,int jj)
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d, %d", k, l);
return 0;
}
A: 12, 12
B: 7, 7
C: 7, 12
D: 12, 7
Right Answer: A
No comments:
Post a Comment