Part 6:-
5. void main()
{
char a[]="123abcd";
clrscr();
printf("%d",strlen(a));
getch();
}
a. 6
b. 7
c. 8
d. 5
6. main()
{
static int var=5;
if(var--)
{
printf("%d",var);
main();
}
}
a. 4 3 2 1 0
b. 4 3 2 1
c. 5 4 3 2 1
d. 5 4 3 2 1 0
ans::a
7. void main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("One"); break;
case j: printf("Two"); break;
default: printf(“Default”); break;
}
}
a. One
b. Two
c. Default
d. Compiler Error
ans::d
8. void main()
{
switch('a')
{
case 'A': printf("Zero"); break;
case 97: printf("One"); break;
default: printf("Error"); break;
}
}
a. Zero
b. One
c. Error
d. Compiler Error
ans::b
9. void main()
{
int p=1,sum=0;
clrscr();
while(p<20)
{
p++;
sum+=p++;
}
printf("\nsum=%d",sum);
}
a. 120
b. 100
c. 110
d. Error
ans::c
10. int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output : %d",x);
changevalue(x);
printf("\nSecond output : %d",x);
}
a. 12 12
b. 11 12
c. 12 13
d. 13 13
11. main()
{
static i=3;
printf("%d",i--);
return i>0?main():0;
}
a. 3 2 1 0
b. 3 2 1
c. 2 1 0
d. 2 1
12. void main()
{
char *ptr="Hello World";
*ptr++;
printf("%s",ptr);
ptr++;
printf("%s",ptr);
}
a. Iello World
Iello World
b. Hello World ello
World
c. ello World
ello World
d. ello World
llo World
13. int const *p;
*p=5;
printf("%d",*p++);
a. 5
b. 6
c. Compiler Error
d. Garbage Value
ans::c
14. void main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d
%d",sizeof(str1),sizeof(str2),sizeof("ab"));
}
a. 5 5 3
b. 4 5 3
c. 2 5 3
d. 1 5 3
ans::c
15. P is a character pointer variable then, what will be the
output of the following statement.
printf("%d %d",sizeof(p),sizeof(*p));
a. 1 2
b. 2 1
c. 2 2
d. 1 1
ans::b
16. void main()
{
char *s[]={"dharma","hewlet-packard","siemens","ibm"};
char **p;
p=s;
printf("%s",++*p);
printf("\n%s",*p++);
printf("\n%s",++*p);
}
a. harma
harma
ewlet-packard
b. dharma
harma
ewlet-packard
c. harma
hewlet-packard
siemens
d. harma
harma
hewlet-packard
ans::a
17. void main()
{
char *ptr="Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s",ptr);
}
a. Samco Systems
Samco Systems
b. Samco Systems
amco Systems
c. amco Systems
amco Systems
d. amco Systems
mco Systems
ans::b
18. #define square(x) x*x
void main()
{
int i=7;
clrscr();
i=64/square(4);
printf("%d",i);
}
a. 7
b. 16
c. 64
d. 4
ans::c
19. #define man(x,y)
(x)>(y)?(printf("%d",x)):(y)
void main()
{
int i=15,j=10,k=0;
k=man(i++,++j);
printf(" %d %d %d",i,j,k);
}
a. 16 17 11 2
b. 17 17 11 2
c. 16 16 11 2
d. 16 17 12 2
ans::a
20. struct one
{
int no:1;
int pl:2;
int x:3;
};
void main()
{
struct one a;
a.no=0;
a.pl=1;
a.x=3;
printf("%d %u",a.no,a.no);
printf("\n%d %u",a.pl,a.pl);
printf("\n%d %u",a.x,a.x);
}
a. 0 0
1 1
3 3
b. 0 0
2 2
3 3
c. 1 1
2 2
3 3
d. 1 1
2 2
2 2
Ans:a
21. void main()
{
struct emp
{
struct e
{
int *a;
}e1;
int a;
};
struct emp emp1;
printf("%d
%d",sizeof(emp1),sizeof(emp1.e1));
}
a. 2 4
b. 2 2
c. 4 4
d. 4 2
ans::d
22. struct emp emp1;
struct emp
{
int a;
};
main()
{
printf("Enter 1 values:");
scanf("%d%d",&emp1.a,&emp1.a);
//The given input is 10 and 25
printf("a=%d
a=%d",emp1.a,emp1.a);
}
a. 10 25
b. 25 25
c. 10 10
d. Compiler Error
ans::b
23. Arrange the code in order to delete a node being pointer
by temp.
a) free(temp)
b) temp->prev->next = temp->next
c) temp->next->prev = temp->prev;
a) b c
a
b) c b a
c) a b c
d) both a
and b
ans::d
24. What does below code do, if temp is pointing to a node
other than first and last node
temp ->
prev ->next = temp ->next;
temp
->next -> prev = temp -> prev;
a) no effect
b) inserts a node
c) deletes a node
d) shuffling of pointers
ans::c
25. which is the faster traversable dynamically growing list
a) Binary Search Tree b)
Singly Linked List
c) Doubly Linked List d)
Using Array
ans::c
1. void main()
{
int a=1,b=2,c=3;
c=(--a, b++)-c;
printf("%d %d %d",a,b,c);
}
(a)0 3 -3 (b)Compile-Time Error (c)0 3 -1 (d)0 3 0
Ans::3
2.
#define
swap(a,b) temp=a; a=b; b=temp;
void main()
{
static int a=5,b=6,temp;
if (a > b)
swap(a,b);
printf("a=%d b=%d",a,b);
}
(a)a=5 b=6 (b)a=6 b=5 (c)a=6 b=0 (d)None of these
Ans::c
3.
void main()
{
int i=5;
printf("%d %d %d %d
%d",++i,i++,i++,i++,++i);
}
(a)Compile-Time
Error (b)10 9 8 7 6 (c)9 8 7 6 6 (d)10 8 7 6 6
Ans:d
4.
void main()
{
int i, n =10;
for (i=1; i<n--; i+=2)
printf("%d", n-i);
}
(a)84 (b)840 (c)852 (d)864
Ans:c
5.
What is the output of the program?#include <stdio.h>
int main(int argc, char *argv[])
{
printf(" %d", printf("Hello Genesis"));
return 0;
}
- Hello Genesis
- 13 Hello Genesis
- Hello Genesis 13
- None of the above
6.
#include <stdio.h> main()
{
switch (5)
{
case 5: printf(" 5 ");
default: printf(" 10 ");
case 6: printf(" 6 ");
}
}
- 5
- 5 10 6
- 5 10
- 5 6
Ans::b
7.
Which argument of function 'strncmp()' specifies number of characters to be
compared? - first
- second
- between 2 strings
- third
ans::d
8.
Which of the following is not a storage class in C? - Stack
- Register
- Extern
- Static
Ans::a
9.
What is the significance of the free() function? - It assigns the pointer a NULL value
- It erases the contents of any type and cleans the pointer
- It places the memory address with the pointer in free store
- It disables the memory address with the pointer
Ans::a
10.
What is the data type of FILE? - integer
- union
- pointer
- structure
ans::d
11.
#include <stdio.h>#define sq(a) a * a
void main()
{
printf("%d", sq(3 + 2));
}
- 25
- 11
- 10
- Compilation error
Ans::b
12.
Which of the following is a non-linear data structure? - Stack
- Queue
- Linked List
- Tree
Ans::d
13.
Which of the following function does not return an integer value? - printf
- scanf
- strcpy
- strlen
ans:c
14.
Which of the following function does not support dynamic memory allocation? - alloc
- realloc
- malloc
- free
ans::a
15.
What is the output of the program if the input is 103?main()
{
int p = 234;
printf(" %d ", printf("%d", p), scanf("%d", &p));
}
- 3 103
- 103
- 103 3
- 103 2
Ans::c
16.
Where do we use a 'continue' statement?- In 'if' statement
- In 'switch' statement
- In 'goto' labels
- None of the above
Ans::d
17.
- Queue is _________________
a)
LIFO
b)
LILO
c)
FIFO
d) Both
b & c
Ans::d
18.
What is the postfix expression for
A + B * C / D – E * F / G
a)
ABC*D/+EFG*/-
b)
ABC*D/+EF*G/-
c)
ABCD/*+EF*G/-
d)
None of these.
Ans::b
19.
Write one statement equivalent to
the following two statements: x=sqr(a); return(x);
Choose from one of the alternatives
Choose from one of the alternatives
(a)
return(sqr(a));
(b)
printf("sqr(a)");
(c) return(a*a);
(c) return(a*a);
(d)
printf("%d",sqr(a));
Ans::b
20.
int
i=5;
int abc(int z)
{
return i/2;
}
main()
{
int i=4;
printf("%d",abc(i=i/4));
}
a) error
b) 5
c) 2
d) 0
int abc(int z)
{
return i/2;
}
main()
{
int i=4;
printf("%d",abc(i=i/4));
}
a) error
b) 5
c) 2
d) 0
ans::c
21.
union U
{
int x;
float y;
char s[2];
};
union U ob;
what is the size of ob in bytes,
{
int x;
float y;
char s[2];
};
union U ob;
what is the size of ob in bytes,
a) 4
b) 2
c) 8
d) 7
b) 2
c) 8
d) 7
ans::a
22.
The operation for adding
and deleting an entry to a stack is traditionally called:
a.add , delete
b.append , delete
c.insert ,
delete
d.push
, pop
e.
front , rear
ans::d
23.
What is the
Infix expression for - + A / * B C D /
* E F G
a)
A + B * C / D – E / F * G
b)
A + B / C * D – E * F / G
c)
A + B * C / D – E * F / G
d)
A - B * C / D + E * F / G
Ans:c
24.
What would be the root node if
we enter the following data set (in the respective order) into a standard
program to construct a Binary search tree?
25, 72, 16, 11, 88, 26, 9, 36, 21, 45, 14, 69
a) 69
b) 25
c) 26
d) 9
Ans::b
25.
what does the code below do, where head is pointing to first
node & temp is a temporary pointer. 10 be the number of nodes
temp =
head;
while
(temp->next->next!=NULL)
{
temp
= temp ->next;
}
temp ->
prev -> next = temp -> next;
temp ->
next -> prev = temp -> prev;
free(temp);
a) no effect
b) deletes some node
c) deletes 2nd last node
d) deletes last node
ans::c
1.
What
will be the output of the following program :
int main()
{
int val=5;
printf("%d %d %d
%d",val,--val,++val,val--);
return(0);
}
(a)3 4 6 5 (b)5 5 6
5 (c)4 4 5 5 (d)None of these
Ans::c
2.
#define Compute(x,y,z) (x+y-z)
int main()
{
int x=2,y=3,z=4;
printf("%d",Compute(y,z,(-x+y)) *
Compute(z,x,(-y+z)));
return(0);
}
(a)40 (b)30
(c)Compile-Time Error (d)None of these
Ans::b
3.
What
will be the output of the following program :
int
main()
{
int val=5;
val=printf("C") +
printf("Skills");
printf("%d",val);
return(0);
}
(a)7 (b)C7 (c)Compile-Time Error(d)CSkills7
Ans::d
4.
What
will be the output of the following program :
int main()
{
char str[]="Test";
if
((printf("%s",str)) == 4)
printf("Success");
else
printf("Failure");
return(0);
}
a)Success b)TestSuccess c)Compile-Time Error(d)Failure
ans::b
5.
What
will be the output of the following program:
int main()
{
int val=5;
printf("%d",5+val++);
return(0);
}
(a)Compile-Time Error
(b)Lvalue required Error
(c)10 (d)11
Ans::c
6.
void main()
{
printf("%d",sizeof(int));
return(0);
}
(a)Data types not
allowed (b)Compile-Time Error(c)3 (d)2
Ans::2
7.
In tree construction which is the suitable efficient data structure?
(a)
Array (b) Linked list (c) malloc (d) Queue
Ans:b
8.
Traverse the given tree using Inorder,
Preorder and Postorder traversals.
a)Inorder : D H B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G C A
b)Inorder : D H B E A F C I G J
Preorder: D H E A B C F G I J
Postorder: H D E B F I J G C A
c)Inorder : D H B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G A C
d)Inorder : H D B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G C A
Ans:a
9.
main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
a. 4 3 2 1 b. 4 3 2 1 0 c. 5 4 3 2 1 d. 0 0 0 0 0
Ans:c
10.
#include<stdio.h>
main()
{
struct xx
{
int x=3;
char
name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
- 3 hello b. Compiler Error c. Run time error d. use dot (.) operator
Ans::s
11.
#include<stdio.h>
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
}
- 5 6.000000 b. 5 5.000000 c. 6 6.000000 d. compiler error
Ans::d
12.
void main()
{
int k=ret(sizeof(float));
printf("\n %d",++k);
}
int ret(int ret)
{
ret += 2.5;
return(ret);
}
- Compiler Error b. 8 c. 6 d. 7
Ans::d
13.
int swap(int
*a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y =
%d\n",x,y);
}
- 20 10 b. 10 20 c. 20 20 d. 10 10
Ans:a
14.
main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
}
- a b. b c. y d. z
ans:b
15.
main()
{
float
i=1.5;
switch(i)
{
case 1:
printf("1");
case
2: printf("2");
default
: printf("0");
}
}
- 0 b. 0 1 2 c. 1 2 0 d. Compiler Error e. 2 0
Ans:d
16.
#define MESS junk
main()
{
printf(“MESS”);
}
a.
Junk b.
Error c. MESS
d. MESS junk
Ans:c
17.
main ()
{
int i = 5;
switch (i)
{
static int
i;
i = 3;
i = i * i;
case 3:
i
= i + i;
case 4:
i
= i + i;
case 5:
i
= i + i;
printf
(“%d”,i);
}
printf
(“%d”,i);
}
- 9 b. 10 10 c. 0 5 d. 18 18 e. 18 5
Ans:c
18.
What would be the output of the following program.
Int fn(int);
main()
{
int i=10;
fn(i);
printf("%d",i);
}
fn(int i)
{
return ++i;
}
(a) 10 (b) 11 (c) 12 (d) Compilation
error
Ans:a
19.
main(){
FILE *fp1,*fp2;
fp1=fopen("one","w");
fp2=fopen("one","w") ;
fputc('A',fp1) ;
fputc('B',fp2) ;
fclose(fp1) ;
fclose(fp2) ;
}
Find the Error, If Any?
a.
no error. But It will over writes on same file.
b.
no error. But It will create one more file.
c.
error. It will not allow.
d.
no error. The new content will append in existing file.
Ans:a
20.void main()
{
int a=555,*ptr=&a,b=*ptr;
printf("%d %d %d",++a,--b,*ptr++);
}
(a)Compile-Time Error (b)555 554 555 (c)556 554 555 (d)557 554 555
Ans:c
21.
what type of Binary Tree is the
following tree below
- binary tree
- strictly binary tree
- complete binary tree
- not a binary tree
22.
If suppose root to be deleted then
which node will be the root node
- B
- G
- Any node
- Both a and b are correct
Ans:a
23.
When fopen() fails to open a file
it returns
a) NULL b) –1
c) 1 d) None of the above
ans:a
24.
Which function is used to detect
the end of file
a) EOF b) feof( )
c) ferror( ) d) NULL
ans:b25.
If the CPU fails to keep the variables in CPU registers, in
that case the variables are assumed
a) static b) external
c) global d) autoans::d
1.
#include<stdio.h>
int x=40;
main()
{
int x = 20;
printf("\n %d",x);
}
Predict the output
20
40
20, 40
None of the above
2.
#include<stdio.h>
main()
{
int x=40;
{
int x = 20;
printf("\n
%d",x);
}
printf("%d",x);
}
Predict the output
20 40
40 20
40
20
3.
#include<stdio.h>
main()
{
extern int a;
printf("\n %d",a);
}
int a=20;
Predict the output
20
0
Garbage value
Error
4.
#include<stdio.h>--------------------------------doubt
main()
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e={"Raja"};
printf("\n %d %f", e.age,
e.sal);
}
0
0.000000
Garbage values
Error
None of the above
5.
#include<stdio.h>
main()
{
int x=10, y=20, z=5, i;
i= x < y < z;
printf("%d", i);
}
o\p:
1
6. Which of the
following definition is correct?
int length
char int
int long
float
double
ans::1
7. What will be the output
#include<stdio.h>
main()
{
int i=4;
switch (i)
{
default:
printf("Default
Value \n");
case 1:
printf("Value
is 1 \n");
break;
case 2:
printf("Value
is 2 \n");
break;
case 3:
printf("Value
is 3 \n");
break;
}
}
o\p:
default
value
8.
#include<stdio.h>------------doubt
main()
{
int i=1;
while()
{
printf("%d",
i++);
if (i >10)
{
break;
}
}
}
Ans::Error
9.
#include<stdio.h>------------------------------doubt
main()
{
int x=30, y =40;
if (x==y)
printf("X is equal
to Y");
else if (x>y)
printf("x is
greater than Y");
else if (x<y)
printf("X is less
than Y");
}
Ans: X is less than
Y
10.
#include<stdio.h>
main()
{
int i=10, j=15;
if(i%2= = j%3)
{
printf("Same");
}
else
{
printf("Different
err");
}
} o\p same
11.
#include<stdio.h>------------doubt
main()
{
int x=4, y, z;
y=--x;
z= x--;
printf("%d %d
%d", x,y,z);
}
Output:
4 3 3
4 3 2
3 3 2
2 3 3
2 2 3
Ans::233
12.
#include<stdio.h>
main()
{
float a = 0.7;
if (a<0.7)
{
printf("C");
}
else
{
printf("C++");
}
}
Try with 0.7f o\p
c++
13.
#include<stdio.h>
main()
{
float fval=7.29;
printf("%d" ,fval);
}
o\p 7
14.
#include<stdio.h>-----------------------doubt
main()
{
printf("Welcome");
main();
}
How many times the
program will execute?
Ans:Infinte
15.
#include<stdio.h>----------------------doubt
void fun(char *);
void main()
{
char a[100];
a[0] = 'A', a[1] = 'B';
a[2] = 'C', a[3] = 'D';
fun(&a[0]);
}
void fun(char *a)
{
a++;
printf("%c", *a);
a++;
printf("%c", *a);
}
o\p b c
16.
#include<stdio.h>
#define MESS
"Junk"
main()
{
printf("MESS");
}
o\p mess
18.
#include<stdio.h>
main()
{
char str[] =
"Sales\0man\0";
printf("%d", strlen(str));
}
o\p 5
19.
#include<stdio.h>
main()
{
char str[] =
"Sales\0man\0";
printf("%d", sizeof(str));
}
o\p 11
20
#include<stdio.h>-------------doubt
#include<string.h>
main()
{
char sentence[80];
int i;
printf("Enter the line of
text");
gets(sentence);
for(i=strlen(sentence)-1;i>=0;i--)
{
putchar(sentence[i]);
}
}
21
#include<stdio.h>-----------------------doubt
main()
{
float a=3.15529;
printf("%6.2f \n",a);
printf("%6.3f \n",a);
printf("%5.4f \n",a);
printf("%2.1f \n",a);
printf("%0.0f \n",a);
}
1. Which of the following does not have an unary operator?
1) -7 2)
++i
3) j 4)
all of the above
2. In printf(),the appearance of the output of the output
can be affected by
1) field with 2)
conversion character
3) flag 4)
all of the above
3. Any of the following programs in c has access to three standard
files:
1) standard input file, standard output file, standard error
file
2) stdin,stdout, stderr
3) keyboard,screen,screen
4) all the above
4. The comma operator(,) is used to
1) permit two different expressions to appear in situations
where only one expression would ordinarily be used
2) Terminate loops or to exit from switch
3) alter the normal sequence of program execution by
transferring control to some other part of the program
4) carry out a logical test and then take one of two
possible actions, depending upon the outcome of the test
5) A variable can be declared static using the keyword.
1) extern 2)
static
3) stat 4)
auto
6) A program can be terminated at any time by calling the
function
1) fflush() 2)
ferror()
3) exit() 4)
clearerr()
7) Heap
1) is a region from where memory is allocated
2) lies between you program and the stack
3) is a finite area
4) all of the above
8) A function can
1) perform a task 2)
return a value
3) change value of actual arguments in call by reference
4) all of the above
9) Function definition void check(int i ,char*j) is
1) call by value 2)call
by reference
3) both (1) and (2) 4)in
valid function definition
10) A union consists of a number of elements that
1) all occupy the same space in memory
2) must be structure
3) are grouped next to each other in memory
4) all have the same type
11) Which of the following array is defined in the
statements
Char name[30]?
1) name
is one dimensiona,30-element integer array
2) name
is one dimensional,30-element floating point array
3) name
is one dimensional ,30-element character array
4) name
is one dimensional,30-elements string array
12) c program contains the following declaration:
Static float table[2][3]={ {1.1,1.2,1.3},
{2.1,2.2,2.3}
};
What is the value of *(*(table+1)+1)?
1) 2.2
2) 1.2
3) 2.1 4) 2.3
13) A c program contains the following declarations and
initial
Assignments:
int i=8,j=5; float x=0.0005,y=-0.01;
Char c=’c’,d=’d’;
What would be the value of the following expression?
(3*i-2*j)%(2*d-3)
1)14 2)18
3) 1 4)
0
14) The declaration : int
f(int 1); means
1) f accepts an integer argument and returns an integer
quantity
2) f accepts two arguments and returns a double precision
quantity, and the second is an integer
3) f accepts three arguments and returns nothing. The first
arguments
is a double-precision quantity, and the second is an integer
4) f does not accepts any arguments but returns a single
character
15) The c language was developed by
1) Marting Richards 2) Dennis Ritchie
3) Ken Thompson 4)
Smith Volt
16) The arguments
of a function are included
between
1) The parenthesis 2)
double quotes
3) curly braces 4)
#
17) The int type of constraints are whole numbers in the
range
1) -23677 to 23678 2) -32768 to 32767
3) -32767 to 32768 4)
-32864 to 32864
18) If the variables i,j and k are assigned the values 5,3
and 2 respectively, then the expression i=j+(k++ =6)+7;
1) gives an error message 2)
assigns a value 16 to i
3) assigns a value 18 to i 4)
assigns a value 19 to i
19) In a relational
expression involving characters, we actually
Compare
1) the
ASCII codes of the characters
2) the
characters themselves
3) neither
of the two
4) binary
code and hexadecimal code
20) The getchar function is used to
1) print the ASCII code of the character
2) to assign a character typed at the keyboard to a variable
3) to print a character on the screen
4) all of the above
21) The word case used in the switch statement represents a
1) function
in the c language
2) data
type in the c language
3) keyword
in the c language
4) global
variable in the c language
22)The logical NOT
operator represented by ! is a
1) unary operator 2)
binary operator
3) ternary operator 4)
octal operator
23) The statement : scanf(“%d”,&i);
1) assigns
an integer to the variable i
2) gives
an error message;
3) does
not assign any value to i
4) assigns
an float to the variable i
24) A pointer is declared by using a statement such as
1) int *p; 2)
point; 3) pointer *p; 4) int &p;
25)The null character is represented by
1) \n 2)\0 3)\o 4)\t
26) The members in the union
1) have different memory locations
2) share the memory with a structure
3) have the same memory location
4) have different memory variable
27) The global variables by default belong to
1) the register type 2)
the static type
3) the auto type 4)
the dynamic type
28) The bit fields are the members of a/an
1) array 2)
structure 3) union 4) inter section
29) In c, square brackets [ ] are used in
1) functions 2)
arrays 3) statements 4) all of the above
30) A fields width specifier in a printf() function
1) specifies the maximum value of a number
2) controls the size of type used to print numbers
3) controls the merging of the program listing
4) specifies how many characters positions will be used for
a number
31) The two operators && and || are
1) arithmetic operators 2)
equality operators
3) logical operators 4)
relational operators
32) The library files that come with c are
1) text editor for program development
2) the compiler and liker
3) program examples
4) files that contain functions which carry out various
commonly
Used operations and calculations
33) precedence determines which operator
1) is evaluated first 2)
is most important
3) is fastest 4)
operates on the largest number
34) The string containing certain required formatting
information
is called
1) argument 2)
character array
3) character string 4)
control string
35) The advantage of a “switch” statement over an “else-if”
construct is
1) a default condition can be used in the “switch”
2) the switch is easier to understand
3) several different conditions can cause one set of
statements to executed in a switch
4) several different statements can be executed for each
case in a switch
36) The header file “math.h” can be used for
1) providing links to assembly-language for calls
2) providing diagnostic and debugging assistance
3) providing support for the string handling functions
4) none of the above
37) The malloc() function
1) returns a pointer to the allocated memory
2) returns a pointer to the first byte of region of memory
3) changes the size of the allocated memory
4) deallocates the memory
38) which of the following expressions will return a 1 if
both bits have
A value of 1; otherwise will return a value of 0?
1) AND 2)OR 3)XOR 4)1’stderr complement
39) If an error occurs while opening a file the file pointer
is assigned a value
1) NULL 2)
stdout 3) sstderr 4) not defined
40) Which of the following backslash codes used for bell?
1) \b 2)
\a 3) \r 4) \s
41) One of the valid keywords in the c language is
1) printf 2)
CHAR 3) auto 4) scanf
42) The comments in a c language program are placed between
1) \* and /* 2)
/ and .* 3) /*and*/ 4) # and #
43) If p and q are assigned the values 2 and 3 respectively
then the statement p=q++
1) gives an error message 2)
assigns a value 4 to p
3) assigns a value 3 to p 4)
assigns a value 5 to p
44) A compound statement is a group of statement included
between a pair of
1) double quots 2)
curly braces
3) parentesis 4)
/ and/
45) The number of the relational operators in the c language
is
1) four 2) six 3) three 4)one
46) In the c language, ‘3’ represents
1) a digit 2)an
integer 3)a character 4)a word
47) In the c language, a hexadecimal number is represented
by writing
1) x 2)
xo 3) 0x 4)h
48) A string in the c language is represented by enclosing a
series of characters in
1) single quotes 2)
double quotes
3) parenthesis 4)
/ and /
49) One structure cannot be
1) a
member of some other structure
2) a
member of the same structure
3) a
member of a union
4) all
of the above
50) Masking is
used
1) to
copy a portion of a given bit pattern to a new variable,
while the remainder of the new
variable is filled with 0’s(using the
bitwise AND)
2) to
copy a portion of a given bit pattern to a new variable,
while the reminder of the new
variable is filled with 1’s (using the bitwise OR)
3) to copy a portion of a given
bit pattern to a new variable, while the remainder of the original bit pattern
is inverted within the new variable
4) all of the above
51) Almost every c program begins
with the statement
1) main() 2) printf() 3)
#include<stdio.h> 4) scanf()
52) A single character input from
the keyboard can be obtained by using the function
1) printf( ) 2) getchar( ) 3)
putchar( ) 4) scanf( )
53) An expression
1) is
a collection of data objects and operators that can be evaluated to a single
value
2) is
a name that substitutes for a sequence of characters
3) causes
the computer to carry out some action
4) all
of the above
54) The expression c=i++ causes
1) the
value of I assigned to c and then I incremented by 1
2) I
to be incremented by 1 and then the value of I assigned to @
3) Value
of I assigned to c
4) I
to be incremented by 1
55)The single character input/output functions are
1) scanf( ) and printf( ) 2)
getchar( ) and printf( )
3) scanf( ) and putchar( ) 4)
getchar( ) and putchar( )
56) The conversion character ‘I’ for data output means that
the
Data item is displayed as
1) a
floating point value with an exponent
2) an
unsigned decimal integer
3) a
signed decimal integer
4) an
octal integer
57) The header file “ctype.h” can be used for
1) providing
links to assembly language for calls
2) providing
diagnostic and debugging assistance
3) providing
support for string handling functions
4) providing
character type identification (Boolean)
and translation
58) In a circular linked list
1) components
are all linked together in some sequential manner
2) there
is no beginning and no end
3) components
are arranged hierarchically
4) forward
and backward transversal within the list is permitted
59) The function ftell( )
1) reads
a character from a file
2) reads
an integer form a file
3) gives
the current position in the file
4) sets
the position to the beginning of the file
60) A c function contain
1)function body 2)argument
declaration
3)a function header 4)all
of the above
1.int a=123.12;
int b=-123.12;
c=a+b;
printf("%2f",c);
a) 0.00
b) 123.12
c) 246.24
d) None of these
2. struct emp
{
int a;
char *name;
};
main()
{
struct emp *e;
printf("%d",sizeof(e));
}
ANs: 2
3. which is the best
thing for linked list than arrays?
i) Insertion
ii) Deletion
iii) Traversal
a) (i)
only
b) (i),(ii) only
c) ii,iii only
d) iii only
4. consider the character array of size 10. When a string is
more than 10
a) Error
b) Overwrites
c) Nothing
d) garbage value
5. main()
{
char *str;
char *fun();
str=fun();
printf("%s",str);
}
char * fun()
{
char *buffer;
strcpy(buffer,"Hello world");
return buffer;
}
a) hello world
b) Compiler error
c) Runtime error
d) None of the above
6. main()
{
char *str;
char *fun();
str=fun();
printf("%s",str);
}
char * fun()
{
char *buffer;
buffer=(char *)
malloc(sizeof(char));
strcpy(buffer,"Hello world");
return buffer;
}
a) hello world
b) Compiler error
c) Runtime error
d) None of the above
ans::a
7) what is the prefix expression for the given Infix
expression A+B*C/D
Ans::+A/*BCD
8) int a;
a=65536;
printf("%d",a);
a) 0
b) Garbage
c) 65535
d) -32768
9) main()
{
char p=65;
printf("%c",p);
}
a) 65 b) p c) error d) none
of the above
10) In a function call, _____________ is passed as
arguments.
a) variables
b) constants
c) Expressions
d) All the above
11) The value of EOF is ___-1______.
12) () is used for __________
a) function body
b) Arguments
c) Return type
d) Declaration of
function
13) How does the string ends?
a) /n
b) /t
c) /0
d) none
14) The range of Unsigned integer is
a) 127 to
-128
b) 0 to
65535
c) Depend up on the compiler
d) -32768
to 32767
15) which one of the
following is a illegal real constants
a) 32.535
b) -1.5E25
to 3.5E65
c)
"53682"
d) -6.583
16) main()
{
int i,a[5];
a[1]=5;
for(i=0;i<5;i++)
{
printf("%d",a[i]);
a++;
}
a) 0 0 0 0
0
b) Garbage
value
c) 0 5 0 0
0
d) Compiler
error
ans:d…..base address can’t be changed a++
17) The size of int is 2 bytes,then what is the size of
short int?
a) 1
b) 2
c) 4
d) 8
18) In a queue,what condition applies
a) First In
First Out
b) Last in
first out
c) Elements
are inserted and deleted at one end
d) Elements
can be inserted and deleted in different ends
19) which of the following statements are true in the case
of doubly linked list
i) Every node is connected to other node
ii) We can
traverse in both the directions
a) i) only
b)ii) only
c) Both i
and ii
d) neither
i nor ii
ans::c
20) main()
{
char
str[]="Wipro Infotech";
char *s;
s=&str[13]-13;
while(*s)
printf("%c",*s++);
}
Ans:: Wipro Infotech
21) char *a="Malayalam";
char *s;
Char *str;
str=a;
s=str+8;
for(;s>=str;s--)
printf("%c",*s);
a) Malayalam
b) malayalaM
c) error
d) None of the
above
22) struct main
{
int a;
int b;
struct main
*e1;
}
printf("%d
%d",sizeof(e1),sizeof(*e1));
23) #define wipro Hai
void main()
{
printf("wipro");
}
24) Is allocating a block of
memory effectively the same as defining an array?
a) True
b) false
25) the size of a
node od doubly linked list is always greater than the single linked list
a) True
b) false
26) Queue is used for
i) Expression
Evaluation
ii) Scheluding
the job in First come First serve
a)
i) only
b)
ii only
c)
both i & ii
d)
neither i nor ii
27) what should be replace ????? in the program to get the
output 25?
?????
void main()
{
int x=2,y=3,j;
j=SQRT(x+y);
printf("%d",j);
}
a) #define
SQRT(int) (int * int)
b) #define
SQRT(int) (int) * (int)
c) #define
SQRT(int) (int + int)
d) #define
SQRT(int) (int) + (int)
28) void fun()
{
static char p[]="Hello";
return p;
}
main()
{
printf("%s",fun());
}
what will be
the output?
Ans::Error
Void function do not return a value.
a) Compiler
Error b) Hello c) Garbage value d) None
29) void main()
{
int *p;
p=(int *)malloc(sizeof(int));
for(i=0;i<5;i++)
printf("%d ",p[i]);
}
What is the
output?
Ans:garbage value
30) main()
{
int i,j;
for(i=1,j=10;i<j;i++,j--);
printf("%d %d",i,j);
}
Ans:6,5
31) Which of these
will pass the address of the pointer *ptr to the function demofun()?
a)
demofun(ptr) b) demofun(&ptr)
c)
demofun(*ptr) d) demofun(*&*ptr);
32) which is not a valid expression
a)
x!=y b) x! c) !x
d) x!y
33) If
max=10,rear=max,front=0,then what will be my queue?
a) Queue
Empty
b) Queue
Full
c) Queue
has one element
d) Queue has
max-1 elements
34) which is an indefinite loop?
a) do
while(0);
b)
for(;0;);
c)
while(1);
d)
while(0);
35) int *ptr;
ptr=(int
*)malloc(10*sizeof(int));
which is correct?
i) All Values
are intialised to garbage values
ii) Creates
memory for 10 integer data
a) i only
b) ii only
c) both i
and ii
d) neither
i nor ii
36) int *ptr;
ptr=(int
*)calloc(10*sizeof(int));
which is correct?
i) All Values are
intialised to zero
ii) Creates
memory for 10 integer data
a) i only
b) ii only
c) both i
and ii
d) neither
i nor ii
37) Struct queue
{
int rear;
int front;
int a[100];
}
struct queue
*q;
then how will you add a new element called 'item'
in the queue?
a)
q->rear[a]=item;
b)
q->a[q->rear]=item;
c)
q->a[rear]=item;
d)
q->rear[q->a]=item;
38) In which of the following we can sort the data without
moving the data
a) Array
b) Single
Linked list
c) Doubly
linked list
d) Binary
search trees
39) Char d=128;
printf("%c",d);
a)128
b)-128
c) error
d) Garbage
values
40) In the following definition
struct node
*ptr;
ptr=(struct
node *)calloc(sizeof(ptr));
a) ptr is
allocated 4 bytes
b) ptr will
be allocated sizeof struct node
c) Error
d) ptr will
have 8 bytes
41) In a doubly
linked list ,if the first node is first and the last node is end,what will be
the output?
traverse(struct node*end)
{
while(end!=NULL)
traverse(end->prev);
printf("%d",end->data);
}
if the input is 1,2,3,4,5 then the output will be
a)
1,2,3,4,5
b)
5,4,3,2,1
c)
compilation error
d) none
42) void main()
{
int b=20;
printf("%d"*&b++);
}
what will be the output?
a) 21 b)20 c) error d) Garbage value
ANS::C
43) how will you refer the last node in the doubly linked
list which is pointed by the pointer variable 'cursor'?
a)cursor==NULL
b)cursor->link=NULL
c)
Cursor->link=0
d)
cursor->data=NULL
44) how will you refer the previous node of the pointer
'cursor' in the doubly linked list (cursor is not in the first or in the last)?
a)cursor->link++
b)cursor=cursor->left
c) Cursor++
d)
cursor->left++
1.
#include<stdio.h>
int x=40;
main()
{
int x = 20;
printf("\n
%d",x);
}
Predict the output
20
40
20, 40
None of the above
2.
#include<stdio.h>
main()
{
int x=40;
{
int
x = 20;
printf("\n
%d",x);
}
printf("%d",x);
}
Predict the output
20 40
40 20
40
20
3.
#include<stdio.h>
main()
{
extern int
a;
printf("\n
%d",a);
}
int a=20;
Predict the output
20
0
Garbage value
Error
4.
#include<stdio.h>--------------------------------doubt
main()
{
struct emp
{
char
name[20];
int
age;
float
sal;
};
struct emp
e={"Raja"};
printf("\n
%d %f", e.age, e.sal);
}
0 0.000000
Garbage values
Error
None of the above
5.
#include<stdio.h>
main()
{
int x=10,
y=20, z=5, i;
i= x < y
< z;
printf("%d",
i);
}o\p
1
6. Which of the following definition is correct?
int length
char int
int long
float double
7. What will be the
output
#include<stdio.h>
main()
{
int i=4;
switch (i)
{
default:
printf("Default
Value \n");
case
1:
printf("Value
is 1 \n");
break;
case
2:
printf("Value
is 2 \n");
break;
case
3:
printf("Value
is 3 \n");
break;
}
}o\p
default value
8.
#include<stdio.h>------------doubt
main()
{
int i=1;
while()
{
printf("%d",
i++);
if
(i >10)
{
break;
}
}
}
9.
#include<stdio.h>------------------------------doubt
main()
{
int x=30, y
=40;
if (x==y)
printf("X
is equal to Y");
elseif
(x>y)
printf("x
is greater than Y");
elseif
(x<y)
printf("X
is less than Y");
}
Statement missing
Expression Syntax
Lvalue required
RValue required
10.
#include<stdio.h>
main()
{
int i=10,
j=15;
if(i%2 = j%3)
{
printf("Same");
}
else
{
printf("Different
err");
}
} o\p same
11.
#include<stdio.h>------------doubt
main()
{
int x=4, y, z;
y=--x;
z= x--;
printf("%d %d %d", x,y,z);
}
Output:
4 3 3
4 3 2
3 3 2
2 3 3
2 2 3
12.
#include<stdio.h>
main()
{
float a =
0.7;
if
(a<0.7)
{
printf("C");
}
else
{
printf("C++");
}
} Try with 0.7f
o\p c++
13.
#include<stdio.h>
main()
{
float
fval=7.29;
printf("%d"
,fval);
}o\p 7
14.
#include<stdio.h>-----------------------doubt
main()
{
printf("Welcome");
main();
}
How many times the program will execute?
32767
65535
Till the stack doesn’t overflow
15.
#include<stdio.h>----------------------doubt
void fun(char *);
void main()
{
char
a[100];
a[0] =
'A', a[1] = 'B';
a[2] =
'C', a[3] = 'D';
fun(&a[0]);
}
void fun(char *a)
{
a++;
printf("%c",
*a);
a++;
printf("%c",
*a);
} o\p b c
16.
#include<stdio.h>
#define MESS "Junk"
main()
{
printf("MESS");
}o\p mess
18.
#include<stdio.h>
main()
{
char str[]
= "Sales\0man\0";
printf("%d",
strlen(str));
}o\p 5
19.
#include<stdio.h>
main()
{
char str[]
= "Sales\0man\0";
printf("%d",
sizeof(str));
}o\p 11
20
#include<stdio.h>-------------doubt
#include<string.h>
main()
{
char
sentence[80];
int i;
printf("Enter
the line of text");
gets(sentence);
for(i=strlen(sentence)-1;i>=0;i--)
{
putchar(sentence[i]);
}
}
21
#include<stdio.h>-----------------------doubt
main()
{
float
a=3.15529;
printf("%6.2f
\n",a);
printf("%6.3f
\n",a);
printf("%5.4f
\n",a);
printf("%2.1f
\n",a);
printf("%0.0f
\n",a);
}
1. printf("%d
%d
%d",sizeof(25.75),sizeof(123),sizeof(‘p’))
a. 2 2 2 b. 4 2
2 c. 8 4 1 d. 8 2 2
2. int i=5;
fun(
)
{
printf("%d\n", i * 3);
}
main( )
{
int i= 2;
{
int i = 3;
printf(" %d", i);
fun();
}
}
a.
3, 15
b.
3, 6
c.
3
d.
0
3. #define xsq(x)
x*x
main( )
{
int i, j;
i = 5;
j = xsq(i-2);
printf(“%d\n”, j);
}
b. –7
c. 9
d. 13
e. 29
4. main( )
{
int a=35;
printf(“ %d %d
%d\n”, a == 35,a=50,a>40);
}
a. 1
50 1
b. 1
50 0
c. 0
50 0
d. 0
50 1
5. void main()
{
char a[]="123abcd";
clrscr();
printf("%d",strlen(a));
getch();
}
a.
6
b.
7
c.
8
d.
5
6. main()
{
static int var=5;
if(var--)
{
printf("%d",var);
main();
}
}
a. 4 3 2 1 0
b. 4 3 2 1
c. 5 4 3 2 1
d. 5 4 3 2 1 0
7. void main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("One"); break;
case j: printf("Two"); break;
default: printf(“Default”); break;
}
}
a. One
b. Two
c. Default
d. Compiler Error
8. void main()
{
switch('a')
{
case 'A': printf("Zero"); break;
case 97: printf("One"); break;
default: printf("Error"); break;
}
}
a. Zero
b. One
c. Error
d. Compiler Error
9. void main()
{
int p=1,sum=0;
clrscr();
while(p<20)
{
p++;
sum+=p++;
}
printf("\nsum=%d",sum);
}
a. 120
b. 100
c. 110
d. Error
10. int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output : %d",x);
changevalue(x);
printf("\nSecond output : %d",x);
}
a. 12 12
b. 11 12
c. 12 13
d. 13 13
11. main()
{
static i=3;
printf("%d",i--);
return i>0?main():0;
}
a. 3 2 1 0
b. 3 2 1
c. 2 1 0
d. 2 1
12. void main()
{
char *ptr="Hello World";
*ptr++;
printf("%s",ptr);
ptr++;
printf("%s",ptr);
}
a. Iello World
Iello World
b. Hello World ello World
c. ello World
ello World
d. ello World
llo World
13. int const *p;
*p=5;
printf("%d",*p++);
a. 5
b. 6
c. Compiler Error
d. Garbage Value
14. void main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("ab"));
}
a. 5 5 3
b. 4 5 3
c. 2 5 3
d. 1 5 3
15. P is a character pointer variable then, what will be the
output of the following statement.
printf("%d %d",sizeof(p),sizeof(*p));
a. 1 2
b. 2 1
c. 2 2
d. 1 1
16. void main()
{
char
*s[]={"dharma","hewlet-packard","siemens","ibm"};
char **p;
p=s;
printf("%s",++*p);
printf("\n%s",*p++);
printf("\n%s",++*p);
}
a. harma
harma
ewlet-packard
b. dharma
harma
ewlet-packard
c. harma
hewlet-packard
siemens
d. harma
harma
hewlet-packard
17. void main()
{
char *ptr="Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s",ptr);
}
a. Samco Systems
Samco Systems
b. Samco Systems
amco Systems
c. amco Systems
amco Systems
d. amco Systems
mco Systems
18. #define square(x) x*x
void main()
{
int i=7;
clrscr();
i=64/square(4);
printf("%d",i);
}
a. 7
b. 16
c. 64
d. 4
19. #define man(x,y)
(x)>(y)?(printf("%d",x)):(y)
void main()
{
int i=15,j=10,k=0;
k=man(i++,++j);
printf(" %d %d %d",i,j,k);
}
a. 16 17 11 2
b. 17 17 11 2
c. 16 16 11 2
d. 16 17 12 2
20. struct one
{
int no:1;
int pl:2;
int x:3;
};
void main()
{
struct one a;
a.no=0;
a.pl=1;
a.x=3;
printf("%d %u",a.no,a.no);
printf("\n%d %u",a.pl,a.pl);
printf("\n%d %u",a.x,a.x);
}
a. 0 0
1 1
3 3
b. 0 0
2 2
3 3
c. 1 1
2 2
3 3
d. 1 1
2 2
2 2
21. void main()
{
struct emp
{
struct e
{
int *a;
}e1;
int a;
};
struct emp emp1;
printf("%d
%d",sizeof(emp1),sizeof(emp1.e1));
}
a. 2 4
b. 2 2
c. 4 4
d. 4 2
22. struct emp emp1;
struct emp
{
int a;
};
main()
{
printf("Enter 1 values:");
scanf("%d%d",&emp1.a,&emp1.a);
//The given input is 10 and 25
printf("a=%d
a=%d",emp1.a,emp1.a);
}
a. 10 25
b. 25 25
c. 10 10
d. Compiler Error
23. Arrange the code in order to delete a node being pointer
by temp.
a) free(temp)
b) temp->prev->next = temp->next
c) temp->next->prev = temp->prev;
a) b c
a
b) c b a
c) a b c
d) both a
and b
24. What does below code do, if temp is pointing to a node
other than first and last node
temp ->
prev ->next = temp ->next;
temp
->next -> prev = temp -> prev;
a) no effect
b) inserts a node
c) deletes a node
d) shuffling of pointers
25. which is the faster traversable dynamically growing list
a) Binary Search Tree b)
Singly Linked List
c) Doubly Linked List d)
Using Array
1. void main()
{
int a=1,b=2,c=3;
c=(--a, b++)-c;
printf("%d %d %d",a,b,c);
}
(a)0 3 -3 (b)Compile-Time Error (c)0 3 -1 (d)0 3 0
2.
#define
swap(a,b) temp=a; a=b; b=temp;
void main()
{
static int a=5,b=6,temp;
if (a > b)
swap(a,b);
printf("a=%d b=%d",a,b);
}
(a)a=5 b=6 (b)a=6 b=5 (c)a=6 b=0 (d)None of these
3.
void main()
{
int i=5;
printf("%d %d %d %d
%d",++i,i++,i++,i++,++i);
}
(a)Compile-Time
Error (b)10 9 8 7 6 (c)9 8 7 6 6 (d)10 8 7 6 6
4.
void main()
{
int i, n =10;
for (i=1; i<n--; i+=2)
printf("%d", n-i);
}
(a)84 (b)840 (c)852 (d)864
5.
What is the output of the program?#include <stdio.h>
int main(int argc, char *argv[])
{
printf(" %d", printf("Hello Genesis"));
return 0;
}
- Hello Genesis
- 13 Hello Genesis
- Hello Genesis 13
- None of the above
6.
#include <stdio.h> main()
{
switch (5)
{
case 5: printf(" 5 ");
default: printf(" 10 ");
case 6: printf(" 6 ");
}
}
- 5
- 5 10 6
- 5 10
- 5 6
7.
Which argument of function 'strncmp()' specifies number of characters to be
compared? - first
- second
- between 2 strings
- third
8.
Which of the following is not a storage class in C? - Stack
- Register
- Extern
- Static
9.
What is the significance of the free() function? - It assigns the pointer a NULL value
- It erases the contents of any type and cleans the pointer
- It places the memory address with the pointer in free store
- It disables the memory address with the pointer
10.
What is the data type of FILE? - integer
- union
- pointer
- structure
11.
#include <stdio.h>#define sq(a) a * a
void main()
{
printf("%d", sq(3 + 2));
}
- 25
- 11
- 10
- Compilation error
12.
Which of the following is a non-linear data structure? - Stack
- Queue
- Linked List
- Tree
13.
Which of the following function does not return an integer value? - printf
- scanf
- strcpy
- strlen
14.
Which of the following function does not support dynamic memory allocation? - alloc
- realloc
- malloc
- free
15.
What is the output of the program if the input is 103?main()
{
int p = 234;
printf(" %d ", printf("%d", p), scanf("%d", &p));
}
- 3 103
- 103
- 103 3
- 103 2
16.
Where do we use a 'continue' statement?- In 'if' statement
- In 'switch' statement
- In 'goto' labels
- None of the above
17.
- Queue is _________________
a)
LIFO
b)
LILO
c)
FIFO
d) Both
b & c
18.
What is the postfix expression for
A + B * C / D – E * F / G
e)
ABC*D/+EFG*/-
f)
ABC*D/+EF*G/-
g)
ABCD/*+EF*G/-
h)
None of these.
19.
Write one statement equivalent to
the following two statements: x=sqr(a); return(x);
Choose from one of the alternatives
Choose from one of the alternatives
(a)
return(sqr(a));
(b)
printf("sqr(a)");
(c) return(a*a);
(c) return(a*a);
(d)
printf("%d",sqr(a));
20.
int
i=5;
int abc(int z)
{
return i/2;
}
main()
{
int i=4;
printf("%d",abc(i=i/4));
}
a) error
b) 5
c) 2
d) 0
int abc(int z)
{
return i/2;
}
main()
{
int i=4;
printf("%d",abc(i=i/4));
}
a) error
b) 5
c) 2
d) 0
21.
union U
{
int x;
float y;
char s[2];
};
union U ob;
what is the size of ob in bytes,
{
int x;
float y;
char s[2];
};
union U ob;
what is the size of ob in bytes,
a) 4
b) 2
c) 8
d) 7
b) 2
c) 8
d) 7
22.
The operation for adding
and deleting an entry to a stack is traditionally called:
a.add , delete
b.append , delete
c.insert ,
delete
d.push
, pop
e.
front , rear
23.
What is the
Infix expression for - + A / * B C D /
* E F G
a)
A + B * C / D – E / F * G
b)
A + B / C * D – E * F / G
c)
A + B * C / D – E * F / G
d)
A - B * C / D + E * F / G
24.
What would be the root node if
we enter the following data set (in the respective order) into a standard
program to construct a Binary search tree?
25, 72, 16, 11, 88, 26, 9, 36, 21, 45, 14, 69
e) 69
f)
25
g) 26
h) 9
25.
what does the code below do, where head is pointing to first
node & temp is a temporary pointer. 10 be the number of nodes
temp =
head;
while
(temp->next->next!=NULL)
{
temp
= temp ->next;
}
temp ->
prev -> next = temp -> next;
temp ->
next -> prev = temp -> prev;
free(temp);
a) no effect
b) deletes some node
c) deletes 2nd last node
d) deletes last node
1.
What
will be the output of the following program :
int main()
{
int val=5;
printf("%d %d %d
%d",val,--val,++val,val--);
return(0);
}
(a)3 4 6 5 (b)5 5 6
5 (c)4 4 5 5 (d)None of these
2.
#define Compute(x,y,z) (x+y-z)
int main()
{
int x=2,y=3,z=4;
printf("%d",Compute(y,z,(-x+y)) *
Compute(z,x,(-y+z)));
return(0);
}
(a)40 (b)30
(c)Compile-Time Error (d)None of these
3.
What
will be the output of the following program :
int
main()
{
int val=5;
val=printf("C") +
printf("Skills");
printf("%d",val);
return(0);
}
(a)7 (b)C7 (c)Compile-Time Error(d)CSkills7
4.
What
will be the output of the following program :
int main()
{
char str[]="Test";
if
((printf("%s",str)) == 4)
printf("Success");
else
printf("Failure");
return(0);
}
a)Success b)TestSuccess c)Compile-Time Error(d)Failure
5.
What
will be the output of the following program:
int main()
{
int val=5;
printf("%d",5+val++);
return(0);
}
(a)Compile-Time Error
(b)Lvalue required Error
(c)10 (d)11
6.
void main()
{
printf("%d",sizeof(int));
return(0);
}
(a)Data types not
allowed (b)Compile-Time Error(c)3 (d)2
7.
In tree construction which is the suitable efficient data structure?
(a)
Array (b) Linked list (c) malloc (d) Queue
8.
Traverse the given tree using Inorder,
Preorder and Postorder traversals.
a)Inorder : D H B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G C A
b)Inorder : D H B E A F C I G J
Preorder: D H E A B C F G I J
Postorder: H D E B F I J G C A
c)Inorder : D H B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G A C
d)Inorder : H D B E A F C I G J
Preorder: A B D H E C F G I J
Postorder: H D E B F I J G C A
9.
main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
b. 4 3 2 1 b. 4 3 2 1 0 c. 5 4 3 2 1 d. 0 0 0 0 0
10.
#include<stdio.h>
main()
{
struct xx
{
int x=3;
char
name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
- 3 hello b. Compiler Error c. Run time error d. use dot (.) operator
11.
#include<stdio.h>
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
}
- 5 6.000000 b. 5 5.000000 c. 6 6.000000 d. compiler error
12.
void main()
{
int k=ret(sizeof(float));
printf("\n %d",++k);
}
int ret(int ret)
{
ret += 2.5;
return(ret);
}
- Compiler Error b. 8 c. 6 d. 7
13.
int swap(int
*a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y =
%d\n",x,y);
}
- 20 10 b. 10 20 c. 20 20 d. 10 10
14.
main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
}
- a b. b c. y d. z
15.
main()
{
float
i=1.5;
switch(i)
{
case 1:
printf("1");
case
2: printf("2");
default
: printf("0");
}
}
- 0 b. 0 1 2 c. 1 2 0 d. Compiler Error e. 2 0
16.
#define MESS junk
main()
{
printf(“MESS”);
}
b.
Junk b.
Error c. MESS
d. MESS junk
17.
main ()
{
int i = 5;
switch (i)
{
static int
i;
i = 3;
i = i * i;
case 3:
i
= i + i;
case 4:
i
= i + i;
case 5:
i
= i + i;
printf
(“%d”,i);
}
printf
(“%d”,i);
}
- 9 b. 10 10 c. 0 5 d. 18 18 e. 18 5
18.
What would be the output of the following program.
Int fn(int);
main()
{
int i=10;
fn(i);
printf("%d",i);
}
fn(int i)
{
return ++i;
}
(a) 10 (b) 11 (c) 12 (d) Compilation
error
19.
main(){
FILE *fp1,*fp2;
fp1=fopen("one","w");
fp2=fopen("one","w") ;
fputc('A',fp1) ;
fputc('B',fp2) ;
fclose(fp1) ;
fclose(fp2) ;
}
Find the Error, If Any?
e.
no error. But It will over writes on same file.
f.
no error. But It will create one more file.
g.
error. It will not allow.
h.
no error. The new content will append in existing file.
20.void main()
{
int a=555,*ptr=&a,b=*ptr;
printf("%d %d %d",++a,--b,*ptr++);
}
(a)Compile-Time Error (b)555 554 555 (c)556 554 555 (d)557 554 555
21.
what type of Binary Tree is the
following tree below
- binary tree
- strictly binary tree
- complete binary tree
- not a binary tree
22.
If suppose root to be deleted then
which node will be the root node
- B
- G
- Any node
- Both a and b are correct
When fopen() fails to open a file
it returns
a) NULL b) –1
c) 1 d) None of the above
24.
Which function is used to detect
the end of file
a) EOF b) feof( )
c) ferror( ) d) NULL
25.
If the CPU fails to keep the variables in CPU registers, in
that case the variables are assumed
a) static b) external
c) global d) auto
1.main()
{
int x,y,z;
x=y=z=1;
z=++x||++y&&++z;
printf("%d
%d %d",x,y,z);
}
2.13. main()
{
int
i=5,j=10;
i=i&=j&&10;
printf("%d
%d",i,j);
}
ans::1 10
3.2. main()
{
int
i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d
%d %d %d %d",i,j,k,l,m);
}
ans::0 0 1 3 1
3.28. main()
{
int
i=4,j=7;
j = j ||
i++ && printf("YOU CAN");
printf("%d
%d", i, j);
}
ans::4 1
3.29
main()
{
int
a=500,b=100,c=300,d=40,e=19;
a+=b-=c*=d/=e%=5;
printf("%d
%d %d %d %d",a,b,c,d,e);
}
2.main( )
{
int k=35;
printf(“ %d %d %d\n”, k == 35,k=50,k>40);
}
ans::0 5 0
3.main( )
{
int x=4,y,z;
y = --x;
z = x--;
printf(“%d %d
%d\n”,x,y,z);
}
ans:2 3 3
1.6. main()
{
int
i=10;
i=!i>14;
printf
("i=%d",i);
}
ans::0
1.20. main()
{
int i=-1;
+i;
printf("i
= %d, +i = %d \n",i,+i);
}
ans -1,-1
1.34. #include<conio.h>
main()
{
int
x,y=2,z,a;
if(x=y%2)
z=2;
a=2;
printf("%d
%d ",z,x);
}
1.42. main()
{
int
i=10,j=20;
j = i, j?(i,j)?i:j:j;
printf("%d %d",i,j);
}
3.4. main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
int main()
{
int x=5,y=6,z=2;
clrscr();
z/=y/z==3?y/z:x*y;
printf("%d",z);
return 0;
}
int main()
{
int a=1,b=2,c=3,d=4;
clrscr();
printf("%d\n",!a?b?!c:!d:a);
printf("%d %d %d
%d",a,b,c,d);
return(0);
}
5.main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
}
1. main()
{
char
*p="hai friends",*p1;
p1=p;
while(*p!='\0')
++*p++;
printf("%s %s",p,p1);
}
2.#include<stdio.h>
#include<conio.h>
void main()
{
char
a[]="abcdef";
char *p=a;
clrscr();
p++;
p++;
p[2]='z';
printf("%s",p);
getch();
}
ans::cdzf
2.6. main()
{
char
*str1="abcd";
char
str2[]="abcd";
printf("%d
%d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
}
ans:: 2 5 5
2.1. main()
{
char s[
]="man";
int i;
for(i=0;s[
i ];i++)
printf("\n%c%c%c%c",s[
i ],*(s+i),*(i+s),i[s]);
}
ans:: m m m
a a a
n n n
1.7. #define square(x) x*x
main()
{
int i;
i =
64/square(4);
printf("%d",i);
}
ans::64
1.7.2 #define cube(x)
x*x*x
main()
{
int b=3,a;
a=cube(b++);
printf("%d
%d",a,b);
}
ans::27,6
1.8. #include <stdio.h>
#define a 10
main()
{
#define a 50
printf("%d",a);
}
ans::50
3.3. #include<stdio.h>
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
3.6. main()
{
static char
names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for
(i=0;i<=4;i++)
printf("%s",names[i]);
}
ans::Lvalue Required.....base address can't be changed names[3]=names[4];
1)Allocating a 2 blocks of memory for 'n' intgers is by
using
a) malloc
b) calloc
c) both malloc and calloc
d) none of the above
2) In queue using linked list, which is correct?
a) both insertion and deltionis made at the front end
b) insertion is made at the beginning and deletion is made
at the last
c) insertion is made at the last and deletion is made at the
beginning
d) both insertion and deltionis made at the back end
3) for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
{
if(i==j)
break;
printf("wipro");
}
}
how many times would wipro to be printed?
1 time
4) all the local variables are stored in -----------------
a) stack
b) heap
c) queue
d) none
ans::a
5) Once you call a function,all the return addresses are
stored in ----------------
a) stack
b) heap
c) queue
d) none
6) Which of the following is true about binary tree
i) all nodes except leaf node has exactly two child
ii) root node is greater than the left sub tree and lesser
than the right sub tree.
a) i only
b)ii only
c) both i and ii
d) neither i nor ii
7) Which of the following is true about complete binary tree
i) all nodes except leaf node has exactly two child
ii) root node is greater than the left sub tree and lesser
than the right sub tree.
a) i only
b)ii only
c) both i and ii
d) neither i nor ii
8) struct node
{
int data;
struct node *left,*right;
};
suppose start and end are the pointers pointing to the
beginning and ending node reapectively.then,what will be the output of the
following snippet
front=start;
back=end;
while(back!=NULL)
{
printf("%d",back->data);
back=back->left;
}
Data Structure
Questions & Answers
1)Consider the following
structure
struct node
{
int info;
struct node *link;
};
Suppose ptr is a
pointer which is not pointing to the first or the last node. Then if we are
going to delete a node after ptr, then the code will be
a) ptr=ptr->link;
b) ptr->link=ptr;
c)
ptr->link=ptr->link->link;
d) ptr=ptr->link->link;
2) Consider the following structure
struct node
{
int info;
struct node *link;
};
Suppose start is
a pointer pointing to the first node of the linked list.
s1 and ptr are the two pointers
(they are not pointing to the first or last node). Then if we are going to
execute the following code,
i) start->link=s1;
ii) s1->link=ptr;
iii) ptr->link=start;
then the list is
a) It is having only 3 nodes with start, s1, ptr
in the list, having start as the first node
b) It is a circular linked list
c) It is a doubly linked list
d) None of the above
3) In a queue, if rear=front then
what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) None of the above
4) In a queue, if rear=0, front=0
then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) None of the above
5) In a queue, if rear=0, front=1 then what will
be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) Queue is circular
6) In a queue,if rear=-1,front=-1
then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) None of the above
7) In a queue, if rear=max-1, front=0
then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) None of the above
8) The postfix expression is
ab+c*d/e-.The values of a, b, c, d, e are 2, 4, 5, 2, 1 respectively. Then the
output is
a) 14
b) 11
c) 20
d) 15
9) The infix expression is
a+b*(c-d)/(e+f)*h then my postfix expression is
a) ab+cd-*ef+h*/
b) abcd-ef+*/h*
c) abcd-*ef+/h*+
d) abcdef+-*/h*+
10) In the stack, if top=0 then
the stack is
a) Stack is empty
b) Stack is full
c) Stack has only one element
d) None of the above
11) Consider the structure
struct node
{
int info;
struct node *left;
struct node *right;
};
We have 10
elements in the list. If the following executes what will be the output?
for(ptr=start;
ptr; ptr=ptr->right)
{
if(ptr->data%2==0)
printf("%d", ptr->data);
}
a) Only even numbers are printed
b) Only odd numbers are printed
c)
Compiler error
d) Only garbage values
12) struct node
{
int data;
struct node *left,*right;
};
Suppose nd is a
node which is not in the beginning and also not in the end. How will you delete
a node after nd?
a)
nd->right=nd->right->left;nd->right->left=nd->left->right;
b)
nd->right=nd->right->right;nd->right->left=nd;
c)
nd->right=nd->right->left;nd->right->left=nd->right;
d)
nd->right=nd->left->right;nd->left->right=nd;
13) struct node
{
int data;
struct node *left,*right;
};
Suppose nd is a
node which is not in the beginning and also not in the end. How will you delete
a node before nd?
a)
nd->left=nd->right->left;nd->right->left=nd->left->right;
b)
nd->left=nd->right->right;nd->left->right=nd->right;
c)
nd->left=nd->left->left;nd->left->right=nd;
d)
nd->left=nd->left->right;nd->left->right=nd;
14) struct node
{
int data;
struct node *left,*right;
};
Suppose ptr is a
node which is not in the beginning and also not in the end. How will you delete
a node ptr?
a)
ptr->left->right=ptr->right;ptr->right->left=ptr->left;free(ptr);
b)
ptr->left->right=ptr->right->right;ptr->left->right=ptr->right;free(ptr);
c)
ptr->left->right=ptr->left->left;ptr->left->right=ptr;free(ptr);
d)
ptr->left->right=ptr->left;ptr->left->right=ptr->left;free(ptr);
15) struct node
{
int data;
struct node *left,*right;
};
Suppose ptr is a
node which is not in the beginning and also not in the end. nd is the new node.
Here is the coding:
i)
ptr->right->left=nd;
ii)
nd->left=ptr;
iii)
ptr->right=nd;
iv)
nd->right=ptr->right;
Then what sequence does it
follows for inserting nd after ptr?
a) i,ii,iii,iv
b)
ii,iv,i,iii
c)iv,iii,ii,i
d) ii,iii,i,iv
16) In the Given Infix expression
which is the root node for your expression tree (A+B)-(C*D)+G/H*I
a) +
b) -
c) *
d) /
17) Consider a binary search tree
insert(10,root);
insert(25,root);
insert(5,root);
insert(8,root);
insert(13,root);
insert(45,root);
insert(70,root);
insert(32,root);
delete(13,root);
insert(66,root);
insert(13,root);
insert(36,root);
What will be the preorder
traversal is
a) 5,8,10,13,25,32,36,45,66,70
b)
10,5,8,25,13,45,32,36,70,66
c) 10,8,5,13,32,45,36,66,32,70
d) 8,5,32,36,10,66,45,70,25,13
19) The preorder traversal is 5,
3, 66, 30, 77, 70 .What will be the root node
a) 5
b) 66
c) 70
d) 30
20) Which one of the following is
true for the binary tree
i) root is greater than the left sub tree and lesser than the right sub
tree
ii) root is lesser than the left sub tree and greater than the right sub
tree
a) only i
b) only ii
c) both i and ii
d)
Neither i nor ii
1. What will be the output of the following program :
void main()
{
printf("%f",123);
}
(a)123 (b)Compile-Time Error (c)123.00 (d)123.000000
2. What will be the
output of the following program :
void main()
{
int a =
-1,b=2,c=3,d=4;
d=++a||++b&&++c;
printf(“%d
%d %d %d”,a,b,c,d);
}
(a) 0 3 4 1 (b) 1 3 4 5 (c)1 3 4 0 (d) 1 2 3 4
3. What will be the output of the following program :
void main()
{
char line[80]; // Max. length=80 Chars
scanf("%[^,]s",line);
printf("\n%s",line);
}
INPUT :Dear,how,
are, you
(a)Compile Error (b)Dear Friends (c) dear (d)
runtime error
4.. main()
{
scanf(“%c%c%c”,&I,&j,&k);
}
Input is : hello India hi // VARIABLES NOT DECLARED
What will be the values of i,j,k ?
a) hello , India, hi b)
h , e , l (c ) compile time
error (d) run time error
5) What will be the
output of the following program :
void main()
{
printf();
}
(a)Run-Time Error (b)Compile-Time Error (c)No Output (d)None of these
6) What will be the
output of the following program :
void main()
{
printf("d%",8);
}
(a)8 (b)Compile Error (c)%d (d)None of these
7) void main()
{
int val=5;
printf("%*d",val); }
(a) 5 (b)5 (c)Compile-Time Error (d)None of these
8. void main()
{
printf("Hi!");
if (0 || -1)
printf("Bye");
}
(a)No Output (b)Hi! (c)Bye (d)Hi!Bye
9) void main()
{
printf("%d %d",sizeof ( 4.56),sizeof(4.56f));
}
(a)8, 4 (b)4,8 (c)8,8 (d)4,4
10,. main()
{
for( i=-2;i ; i++)
printf(“hi\n”);
}
here the loop is performed how
many times ?
(a) 2
( b) 1 ( c) 3
d) infinite
11. ) which of the
following doesnot change value of
variable i .
a) i++ (b)
i+1 (c) i=i+1
(d) i+=1
*12. union u
{
Int a;
Char ch[2];
}u1;
U1.a=5;
U1.ch[0]=4 ; u1.ch[1]=2;
Printf(“%d”,a); // IT SHOULD BE u1.a ( ans: 516)
}
(a) 5 (b) 42
( c) 1028 (d) 24
13. void main()
{
int x, y, z;
x = 27 ;
y = x % 5;
z = x / 5 ;
} what value y and z hold currently :
(a) 2,5
(b) 2,5.4 (c) 2,5.000000
(d) none of these
14. int i=10,j=25;
Double k;
K = j/i;
Printf(“%lf”,k);
(a) 2 (b) 2.5
(c) 2.499999 (d) invalid type conversion
15. static int
choice;
switch(++choice,choice+1,choice-2,choice+=1)//choice
=2
Currently choice
will hold what value in Switch statement:
(a) 2 (b)
0 (c) invalid switch
statement (d) -1
16,. struct s
{
int rno=10;//cannot declare here
}s1;
printf(“%d”, s1.rno);
(a) compile error (b) runtime error (c)
10 (d) 0
16. void main()
{
int a=1,b=2,c=3;
c=(--a,b++)-c;
printf("%d %d %d",a,b,c);
}
(a)0 3 -3 (b)Compile-Time Error (c)0 3 -1 (d)0 3 0
17. #define swap(a,b)
a=b ;temp=a; ; b=temp;
void main()
{
static int a=5,b=6,temp;
if (a > b)
swap(a,b);
printf("a=%d b=%d",a,b);
}
(a)a=5
b=6 (b)a=6 b=5 (c)a=5 b=5 (d)None of these
18. void main()
{
unsigned int val=5;
printf("%u %u",val,val-21);
}
(a)Compile-Time
error (b)5 -6 (c)5 65520 (d)None
of these
19. a=5,b=6;
(++a<++b) ?—a:--b;
Printf(“%d %d”,a,b);
}
(a)
5 6 (b) 6 7
(c) 5 7
(d) 6 6
20. void main()
{
int x=4,y=3,z=2;
*&z*=*&x**&y;
printf("%d",z);
}
(a)Compile-Time error (b)Run-Time Error (c)24 (d)Unpredictable
21,. char
a[2][11]={“morning”,”India”)
printf(“%s”,
*(a[0]+3));
(a) compile error (b)
n (c) i
(d) none of these
*22. #define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
a)compilation error b)runtime
error c)100 d)var##12
23,. int I=40;
Int *p= i;//there sud be p=&i;
I++;
Int *q = i;
Printf(”%d %d”, *p, *q);
}
(a) 40
41 (b) 41
41 (c) 40
40 (d) compile time error
24. The syntax of a function call statement is
a) function name (argument list);
b) [storage class] function name (parameter list);
c) function name (parameter list);
d) [return type] function name (argument
list);
25. int a[5] = { 1,2,3,4,5};
a++;
printf(“%d”,*a);
(a) 1 (b)
2 (c) address of a[0] (d) none of these
26. feof ,NULL , EOF are used for the following commands
respectively
(a) fgetc,fgets,fread (b)
fread, fgetc,fgets (c) fread,
fgets,fgetc (d) none of these//ans sud
be c
27, . which of the following mode is useful for editing a
file ?
(a) w+
(b) r+ (c) a+ (d) a
28, the term FILE is
a
(a) header file (b)
Predefined function (c) Predefined
structure (d) none of these
29,. int p[3][5] = {
{ 2, 4, 6, 8, 10},
{ 3, 6, 9, 12, 15},
{ 5, 10, 15, 20, 25}
};
What is the vlalue of *(*(p+1)+1)+1 , *(*(p+1)+2)//ans is 7
9 so none of these
(a) 6, 7 (b) 7,12
(c) 6 , 13 (d) none of these
30.to locate the position of file pointer in a file, which
of the following function is used
(a) ftell()
(b) fseek ( ) (c)
fwrite( ) (d) fread( )
- Which data structures used to perform recursion?
- FIFO Structure
- LIFO Structure
- LILO Structure
- NON Linear Structure
- The operation for adding an entry to a stack is traditionally called:
- add
- append
- insert
- push
- I have implemented the queue with a linked list, keeping track of a front pointer and a rear pointer. Which of these pointers will change during an insertion into a NONEMPTY queue?
- Neither changes
- Only front_ptr changes.
- Only rear_ptr changes.
- Both change.
- Suppose we have an array implementation of the Queue, with ten items in the Queue stored at Que[0] through Que[9]. The CAPACITY is 30. From where does the DeleteQue function deletes item in the array?
- Que[0]
- Que[1]
- Que[9]
- Que[10]
- If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?
- ABDC
- DCAB
- DCBA
- ABCD
*36.Here is an infix expression: 6+2*(1*5-9). Suppose that
we are using the usual stack algorithm to convert the expression from infix to
postfix notation. What is the maximum number of symbols that will appear on the
stack AT ONE TIME during the conversion of this expression?
- 1
- 2
- 3
- 4
- 5
- One difference between a queue and a stack is:
- Queues use two ends of the structure; stacks use only one.
- Queues require dynamic memory, but stacks do not.
- Stacks require dynamic memory, but queues do not.
- Stacks use two ends of the structure, queues use only one.
- If we draw a binary Tree for the expression : A * B - (C + D) * (P / Q) and traversed in Preorder, then we will get the following output.
- -*AB*+CD/PQ
- AB*CD+PQ/*-
- ABCDPQ-*+*/
- *-+*/ABCDPQ
- Suppose that p is a pointer variable that contains the NULL pointer. What happens if your program tries to read or write *p?
- A syntax error always occurs at compilation time.
- A run-time error always occurs when the program finishes.
- The results are unpredictable.
- A run-time error always occurs when *p is evaluated.
- Which of the following stack operations could result in stack Overflow flow?
- is_full
b.
pop
- push
- Two or more of the above answers
- Suppose think there is a linked list with 10 nodes and a pointer Ptr pointing to the Second node. Then which of the following statement will cause Ptr to point 5th node data.
- Ptr->next->next->data
- Ptr->next->data
- Ptr->next->next->next->data
- Ptr->next->next->next
- A Full Binary Search Tree contains, How many Nodes? (where ‘n’ is height)
- n nodes
- 2^(n-1) nodes
- 2^n nodes
- (2^n)-1 nodes
- A Structure which can refer an another Structure of same type is called as:
- Structure within structure
- Nested structure
- Self referential structure
- Dynamic structure
- Suppose think there is a Double linked list with 15 nodes and a pointer Ptr pointing to the Fifth node. Then which of the following statement will cause Ptr to point 3th node data.
- Ptr->next->prior->prior
- Ptr->next->next->next
- Ptr->next->prior->prior->prior
- Ptr->next->prior->next->prior
- What kind of list is best to access the item at given position n?"
- Doubly-linked lists.
- Lists implemented with an array.
- Singly-linked lists.
- Doubly-linked or singly-linked lists are equally best
- Suppose Ptr points to a node in a linked list. What Boolean expression will be true when Ptr points to the tail node of the list?
Ptr == NULL
Ptr->link == NULL
Ptr->data == NULL
Ptr->data == 0.0
- None of the above.
- the given below is login for Reverse traversal of a double linked list, replace the XXXXXXX with correct statements.
for( XXXXXXX )
{
printf(“%d”,
ptr->marks);
}
- ptr =first; (ptr); ptr = ptr->next
- ptr = last; (ptr); ptr = ptr->prior
- ptr = last; (ptr); ptr = ptr->next
- ptr = first; (ptr); ptr = ptr->prior
- In a Binary Search tree a new node is always inserted as:
- Right child
- Left child
- Leaf node
- Non leaf node
- Suppose Ptr needs to point last but one node in a Double linked list. Which of the statement will give me the result?
- Ptr=first->prior
- Ptr=last->prior
- Ptr=last->next
- Ptr=first->next->prior
- Which of the following applications may use a stack?
- A parentheses balancing program.
- Evolution of postfix expression.
- Syntax analyzer for a compiler.
- All of the above.
1.Consider the following statement
:
s= fscanf(infile, “%c”,
&nextChar);
what is true about the above
statement?
A. infile
is the name of a file
B. infile
is the name of a variable of type FILE*
C. after
the fscanf executes, s contains the next character read from the file (unless
there is no data left on the file)
a. A
only
b. B
only
c. C
only
d. All
of A, B and C
e. None
of A, B, or C
Answer:
b. B only
- Which of the following can be used across files
- extern
- volatile
- static
- const
Answer: a
- When fopen() fails to open a file it returns _______
- NULL
- -1
- 1
- None of the above
Answer: a. NULL
- The EOF is equivalent to
- -1
- 1
- 0
- None of the above
Answer: a
4.
What
will be the output of following code assuming file already exists with some
contents
#include<stdio.h>
main()
{
FILE *ptr;
char i;
ptr=fopen("zzz.c","r");
while((i=fgetch(ptr))!=EOF);
printf("%c",i);
}
a. contents
of zzz.c
b. error
c. contents
of zzz.c followed by an infinite loop
d. prints
some data after EOF
reaches.
Answer:
D
6. what is the output of the following
#define assert(cond) if(!(cond)) \
(fprintf(stderr, "assertion failed: %s,
file %s, line %d \n",#cond,\
__FILE__,__LINE__), abort())
void main()
{
int i = 10;
if(i==0)
assert(i < 100);
else
printf("This statement becomes else
for if in assert macro");
}
a. no
output
b. error
c. else
part is printed
d. prints
assertion failed in the file
Answer: c
7. What will be the output of the following code
segmet
FILE *fp1,*fp2;
fp1=fopen("one","w")
;
fp2=fopen("one","w") ;
fputc('A',fp1) ;
fputc('B',fp2) ;
fclose(fp1) ;
fclose(fp2) ;
fp2=fopen("one","w") ;
fputc('A',fp1) ;
fputc('B',fp2) ;
fclose(fp1) ;
fclose(fp2) ;
a. No
Error, but it will over writes on same file
b. Error
in pointer declaration
c. Runs
successfully
d. None
Answer: C
- Considering the code
Char x[20];
----
-----
fgets(x,20,fp);
printf(“%s”,x);
where
fp points to the file which contains the data in the following format
wipro
innovation
program
what is the output?
- wipro
- wiproinnovationprogr
- ram
- wipro\ninnovation\npro
Answer: A
- When file opened in mode “ab”
- pointer is placed at the beginning of file
- end of the file
- error in opening
- none of the above
Answer: b
- Consider the following statement
fseek(fp,50,4);
which among the following is
correct
- moves the file pointer to beginning of file
- moves the file pointer to the 50th byte from beginning of file
- moves file pointer to the 50th byte from end of file
- compilation error
Answer: d
Heya i am for the primary time here. I found
ReplyDeletethis board and I find It truly useful & it helped me out a lot.
I am hoping to offer one thing again and help others such
as you helped me.
Feel free to surf to my website; Bicykle Basket
I do not know whether it's just me or if everyone else experiencing issues with your site. It looks like some of the written text in your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This may be a issue with my internet browser because I've had this happen before.
ReplyDeleteKudos
Here is my webpage odpružen矶idlice se z൩tem
Good day I am so glad I found your webpage,
ReplyDeleteI really found you by error, while I was browsing on Askjeeve for something else, Anyways I am here
now and would just like to say thanks a lot for a remarkable post and a all round entertaining
blog (I also love the theme/design), I don't have time to browse it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the excellent job.
my web page; Online Casinos
Hello there! This post couldn't be written any better! Reading this post reminds me of my good old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Many thanks for sharing!
ReplyDeleteMy site: http://onlinecasino2013.blogspot.com
Hi my friend! I want to say that this article is awesome, great written and come with almost all significant infos.
ReplyDeleteI would like to see extra posts like this .
my website :: http://onlinecasino2013.blogspot.com
Fascinating blog! Is your theme custom made or did you download it from somewhere?
ReplyDeleteA design like yours with a few simple tweeks would really make my blog jump out.
Please let me know where you got your theme. Appreciate it
Stop by my homepage :: Casinos Online
This piece of writing is actually a fastidious one
ReplyDeleteit assists new web viewers, who are wishing in favor of blogging.
Here is my web site ... Casinos Online
Hello mates, how is all, and what you wish for to say on the topic of this post, in
ReplyDeletemy view its actually awesome designed for me.
Feel free to surf to my weblog ... onlinecasino2013.blogspot.com
Hey there would you mind stating which blog platform you're using? I'm looking
ReplyDeleteto start my own blog in the near future but I'm having a hard time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking
for something unique. P.S My apologies for getting off-topic but I had
to ask!
Here is my webpage :: Best Online Casinos
I have been exploring for a little for any high quality articles or
ReplyDeleteweblog posts in this sort of area . Exploring in Yahoo I
eventually stumbled upon this web site. Reading this information So i'm happy to convey that I have a very excellent uncanny feeling I discovered just what I needed. I such a lot indisputably will make sure to don?t omit this web site and provides it a look on a continuing basis.
Look into my page online casinos
You actually make it seem so easy with your presentation but I
ReplyDeletefind this matter to be actually something that I think I would never understand.
It seems too complex and extremely broad for me.
I am looking forward for your next post, I'll try to get the hang of it!
Here is my site - Online Casinos
Very descriptive post, I liked that bit. Will there be a part 2?
ReplyDeleteAlso visit my web blog ... online Casinos
Hey would you mind sharing which blog platform you're using? I'm going to start my own blog soon but I'm having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking for something unique.
ReplyDeleteP.S Sorry for being off-topic but I had to ask!
my weblog: Best Online Casino
It's remarkable for me to have a web page, which is helpful in support of my experience. thanks admin
ReplyDeleteAlso visit my web-site :: onlinecasino2013.blogspot.com
Pertaining to course, the question then becomes the
ReplyDeleteways do you start out off making profits very easily in penny investments with the the bare minimum
risk? It therefore works without saying that may greater
prudence is just needed when exchanging in penny stock which
you have are hot dollar stocks.
Here is my page - yahoo search engine
Greetings, I believe your blog could possibly be having
ReplyDeletebrowser compatibility problems. When I take a look at your
web site in Safari, it looks fine however, if opening in I.
E., it's got some overlapping issues. I just wanted to provide you with a quick heads up! Other than that, wonderful blog!
Feel free to visit my website onlinecasino2013.blogspot.com
Nice post. I learn something totally new and challenging on sites I stumbleupon
ReplyDeleteevery day. It will always be helpful to read through articles from other authors and practice something from their web sites.
Here is my weblog :: www.nanobusiness2010.com
It is appropriate time to make some plans for the future and it is time to be happy.
ReplyDeleteI've read this post and if I could I wish to suggest you some interesting things or suggestions. Maybe you can write next articles referring to this article. I want to read even more things about it!
Feel free to surf to my web site; Mobile Casinos For Usa Players
Excellent post. I was checking continuously this blog and I'm impressed! Extremely helpful information specially the last part :) I care for such information much. I was looking for this certain information for a very long time. Thank you and good luck.
ReplyDeleteStop by my blog; mobile casino uk
Heya i'm for the primary time here. I came across this board and I to find It truly useful & it helped me out much. I'm hoping to offer something again and aid others like you aided me.
ReplyDeleteFeel free to visit my page ... mobile casino winasugo
Hello! I've been following your weblog for a while now and finally got the courage to go ahead and give you a shout out from Huffman Texas! Just wanted to mention keep up the great work!
ReplyDeleteLook at my page ... http://bestuff.com
Howdy! I'm at work surfing around your blog from my new iphone 3gs! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the great work!
ReplyDeleteMy weblog :: www.lijit.com
Thank you for the good writeup. It in fact was a amusement
ReplyDeleteaccount it. Look advanced to far added agreeable from you!
By the way, how can we communicate?
Feel free to surf to my web-site: no deposit bonus cc
I know this if off topic but I'm looking into starting my own blog and was wondering what all is required to get setup? I'm assuming
ReplyDeletehaving a blog like yours would cost a pretty penny? I'm not very web savvy so I'm not 100% certain.
Any suggestions or advice would be greatly appreciated.
Many thanks
my homepage ... www.purevolume.com
I do not know whether it's just me or if perhaps everybody else experiencing issues with your website. It seems like some of the text on your posts are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them as well? This may be a problem with my browser because I've had this happen previously.
ReplyDeleteThanks
My weblog; casino bonus codes
My partner and I stumbled over here from a different web page and thought I should check things out.
ReplyDeleteI like what I see so i am just following you.
Look forward to going over your web page again.
Here is my page ... journals.fotki.com
So there are people now with a very specific talent for crucial penny stocks.
ReplyDeletePaying and selling penny stocks is a distinct way to generate funds and develop into properly off.
Check out my page :: yahoo search engine
Thanks very interesting blog!
ReplyDeleteLook at my web blog; latest casino bonus codes
Superb, what a webpage it is! This web site provides useful data to
ReplyDeleteus, keep it up.
Feel free to surf to my homepage; cs.adamant.net
Thank you for the auspicious writeup. It in fact was once
ReplyDeletea leisure account it. Look complicated to far delivered agreeable from
you! However, how could we keep up a correspondence?
Feel free to surf to my website watch movies free online
Hi, just wanted to mention, I enjoyed this blog post. It was funny.
ReplyDeleteKeep on posting!
my web blog ... rtg casino no deposit codes
Hello! I'm at work surfing around your blog from my new apple iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the fantastic work!
ReplyDeleteFeel free to surf to my page :: rtg casinos no deposit codes for jan 2013
A chronometer could be the most accurate along with the most costly mechanical.
ReplyDeleteA Will this be a wristwatch for everyday use or perhaps is for special occasions.
Technology in your world sure is different hasn't it.
Here is my homepage - watches-bestprice.com
There are lots of markets that you are able to attend, especially about the weekend and during the holidays.
ReplyDeleteRather, it could be better if you will put effort when purchasing gifts
for your attendants. This has brought the designer wears and accessories into fashion, people don't mind throwing huge amounts of money to acquire what they love and believe will be admired by many going for a versatile and classy look.
Feel free to surf to my page; jewelry
Hi there, You have done an excellent job. I'll definitely digg it and personally suggest to my friends. I'm confident they will be benefited from this web
ReplyDeletesite.
my website rtg casino codes
Having read this I believed it was really informative.
ReplyDeleteI appreciate you finding the time and effort to
put this article together. I once again find myself spending way
too much time both reading and commenting. But so what, it was still worth it!
My web page; new rtg casinos
Magnificent website. A lot of useful info here.
ReplyDeleteI am sending it to a few friends ans additionally sharing in delicious.
And obviously, thanks to your sweat!
Here is my web blog; rtg casinos no deposit codes
Hello there, I discovered your website by means of Google at the same time as searching for
ReplyDeletea comparable matter, your web site came up, it seems good.
I have bookmarked it in my google bookmarks.
Hi there, simply turned into alert to your blog through Google,
and located that it's really informative. I'm gonna be careful for brussels.
I'll be grateful if you proceed this in future. Lots of people shall be benefited from your writing. Cheers!
Here is my homepage; rtg casinos no deposit codes for jan 2013
My brother suggested I might like this website. He used to be entirely right.
ReplyDeleteThis publish actually made my day. You can not consider simply
how much time I had spent for this information! Thanks!
My web page: casino bonus
WOW just what I was searching for. Came here by searching for casino bonus 2 blog
ReplyDeleteHere is my blog post :: best casino bonus free money
I love your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to
ReplyDeletedo it for you? Plz reply as I'm looking to design my own blog and would like to find out where u got this from. thanks a lot
My website: casino bonus