freetests4u.com

Online knowledge sharing platform

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

1.
What will be output if you will compile and execute the following C code ?

#include<`stdio.h`>    (Please neglect `` this signs)
int main()
{
int x;
for(x=1;x<=5;x++);
printf("%d",x); return 0;
}

4
5
6
Compiler error
None of the above
2.
What is the output of this program ?

void main()
{
int i=3;
int *j=&i;
clrscr();
printf("%d%d",++*j,*(&i));
}

3 3
4 3
4,address of i printed
Error: L value required
None of the above
3.
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
14
24
Infinite loop
Compilation error
4.
What will be output of following C code ?

#include<`stdio.h`>    (Please neglect `` this signs)
int main()
{
int *p1,**p2;
double *q1,**q2;
printf("%d %d ",sizeof(p1),sizeof(p2));
printf("%d %d",sizeof(q1),sizeof(q2));
getch();
return 0;
}

1   2   4   8
2   4   4   8
2   2   2   2
2   4   2   4
2   2   4   4
5.
What is the output of the following code ?

#include<`stdio.h`>    (Please neglect `` this signs)
void swap(int&, int&);
void main()
{
int a = 10,b=20;
swap (a++,b++);
printf(" %d %d ",a, b);
}
void swap(int& x, int& y)
{
x+=2;
y+=3;
}

30, 60
14, 24
11, 21
10, 20
None of the above
6.
#include<`stdio.h`>    (Please neglect `` this signs)
void main()
{
while (1)
{ if (printf("%d",printf("%d")))
break;
else
continue;
}
}

The output is :

1
Compile time error
Goes into an infinite loop
Garbage values
None of these
7.
What will be output of the following program ?

#include<`stdio.h`>    (Please neglect `` this signs)
int main()
{
float a=0.7;
if(a<0.7)
{
printf("C");
}
else
{
printf("C++");
}
return 0;
}

0.7
C
C++
Compilation error
None of these
8.
The statement which prints out the values 1 to 10 on separate lines, is

for( count = 1; count <= 10; count = count + 1) printf("%d ",count);
for( count = 1; count < 10; count = count + 1) printf("%d ",count);
for( count = 0; count <= 9; count = count + 1) printf("%d ",count);
for( count = 1; count <> 10; count = count + 1) printf("%d ",count);
None of these
9.
The control automatically passes to the first statement after the loop in

continue statement
break statement
switch statement
if statement
None of the above
10.
Recursive procedure are implemented by

Queue
Stack
Tree
Linear list
None of the above
11.
An array of pointers is same as

pointer to array
pointers to pointers
pointer to function
pointer to structure
None of the above
12.
A compiler is used to convert the following to object code which can be executed

High-level language
Low-level language
Assembly language
Natural language
None of these
13.
During initializing a union

Only one member can be initialised.
All the members will be initialised.
Initialisation of a union is not possible.
Some members can be initialised.
None of these
14.
Which of the following is the feature of stack ?

All operations are at one end
It cannot reuse its memory
All elements are of different data types
Any element can be accessed from it directly
None of these
15.
Recursion is sometimes called

Circular definition
Complex definition
Procedure
Union
None of these
16.
What is time required to insert an element in a stack with linked implementation ?

(1)
(log2n)
(n)
(n log2n)
2n


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)