freetests4u.com

Online knowledge sharing platform

CDAC CCAT Section B Mock Test-4 (15 Questions, Time: 15 minutes)

1.
What is time required to insert an element in a stack with linked implementation ?

(1)
(log2n)
(n)
(n log2n)
2n
2.
Each C preprocessor directive begins with

#
include
main()
{
}
3.
When is linear queue said to be empty ?

Front==rear
Front=rear
Front=rear-1
Front=rear+1
None of these
4.
The output of this program is :

int a = 10;
void main()
{
int a = 20;
cout << a << ::a;
}

10 20
20 10
20 20
Syntax error
None of these
5.
What will be output if you will compile and execute the following c code ?

struct marks
{
int p:3;
int c:3;
int m:2;
};
void main()
{
struct marks s={2,-6,5};
printf("%d %d %d",s.p,s.c,s.m);
}

2 2 1
2 -6 1
2 -6 5
Compiler error
None of these
6.
What is the output of the following code ?

void main()
{
int a=0;
int b=0;
++a == 0 || ++b == 11;
printf(" %d,%d",a,b);
}

0, 1
1, 0
0, 0
1, 1
Error
7.
What is the output of the following code ?

#include<`stdio.h`>    (Please neglect `` this signs)
void main()
{
int arr[2][3][2]={{{2,4},{7,8},{3,4},}, {{2,2},{2,3},{3,4}, }};
printf(" %d",**(*arr+1)+2+7);
}

7
11
16
25
Error
8.
#include<`stdio.h`>    (Please neglect `` this signs)
void main()
{
int x=10;
(x<0)?(int a =100):(int a =1000);
printf(" %d",a);
}

10
100
1000
Error
None of these
9.
What is the output of the following code ?

#include<`stdio.h`>    (Please neglect `` this signs)
void main()
{
int arr[]={0,1,2,3,4,5,6};
int i,*ptr;
for(ptr=arr+4,i =0; i<=4; i++) printf(" %d",ptr[-i]);(as the 0=4,for -1 it becomes =3)
}

Error
6 5 4 3 2
4 3 2 1 0
0 garbage garbage garbage garbage
None of these
10.
What is the output of this program ?

struct num
{
int no;
char name[25];
};
void main()
{
struct num n1[]={{25,"rose"},{20,"gulmohar"}, {8,"geranium"},{11,"dahalia"}};
printf("%d%d" ,n1[2].no,(*&n1+2)->no+1);
}

8 8
8 9
9 8
8 , unpredictable
Error
11.
What is the output of the following code ?

#include<`stdio.h`>    (Please neglect `` this signs)
main()
{
register int a=2;
printf(" Address of a = %d,", &a);
printf(" Value of a = %d",a);
}

Linker error
Compile time error
Address of a, 2
Error
None of these
12.
What will be output of following C code ?

#include<`stdio.h`>    (Please neglect `` this signs)
extern int x;
int main()
{
do
{
do
{
printf("%o",x);
}
while(!-2);
}
while(0);
return 0;
}
int x=8;

0
8
9
10
11
13.
Output of the following program fragment is :
x = 5;
y = x++;
printf("%d%d", x, y);


5, 5
5, 6
6, 5
6, 6
None of these
14.
What will be output of following C code ?

#include<`stdio.h`>    (Please neglect `` this signs)
int main()
{
static int i;
for(++i;++i;++i)
{
printf("%d ",i);
if(i==4) break;
}
return 0;
}

4
24
25
34
Infinite loop
15.
The loop in which the statements within the loop are executed at least once is called ______

do-while
while
goto
for
None of these
16.
The statement that prints out the character set from A-Z, is :

for( a = 'z'; a < 'a'; a = a - 1) print f("%c", &a);
for( a = 'a'; a <= 'z'; a = a + 1 print f("%c", &a);
for( a = 'A'; a <= 'Z'; a = a + 1) print f("%c", a);
for( a = 'Z'; a <= 'A'; a = a + 1) print f("%c", a);
None of these


CDAC CCAT Mock Tests

CDAC-CCAT test 1 (section A)

CDAC-CCAT test 2 (section A)

CDAC-CCAT test 3 (section A)

CDAC-CCAT test 4 (section A)

CDAC-CCAT test 5 (section A)

CDAC-CCAT English test (section A)

CDAC-CCAT test 1 (section B)

CDAC-CCAT test 2 (section B)

CDAC-CCAT test 3 (section B)

CDAC-CCAT test 4 (section B)