wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

TCS Preparation

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

In C language, if a function return type is not explicitly defined then it defaults to what data type?

a)

int

b)

char

c)

float

d)

void

2.

realloc() function is used to

a)

Get back the memory that was released earlier usingdree() function

b)

Reallocate a file pointer when switching between files

c)

Change the size of an array

d)

Change the size of the dynamically allocated memory

3.

Which of the below is NOT a data type in C language:

a)

signed int

b)

big int

c)

short int

d)

long int

4.

Which of the following is NOT a valid storage class in C language?

a)

Extern

b)

Dynamic

c)

Register

d)

Auto

5.

Eesha wrote a function fact( ) in "C" language to calculate factorial of a given number and saved the file as fact.c. She forgot to code the main function to call this fact function. Will she be able to compile this fact.c without the main() function?

a)

Yes, she can compile provided the compiler option -no strict-checking is enabled.

b)

No, she can not compile as the main function is required to compile any C program file.

c)

Yes, she can compile as main( ) is not required at compile time.

d)

Yes, she can compile and run as the system will supply default values to fact function.

6.

The difference between variable declaration and variable definition is:

a)

Declaration and definition are the same. There is no difference.

b)

A declaration is used for variables and definitions is used for functions.

c)

Declaration associates type to the variable whereas definition associates scope to the variable.

d)

Declaration associates type to the variable whereas definition gives the value to the variable.

7.

How many times the below loop will be executed?

#include<stdio.h>

int main()

{

int x, y;

for(x=5;x>=1;x--)

{

for(y=1;y<=x;y++)

printf("%dn",y);

} }

a)

15

b)

11

c)

10

d)

13

8.

Are the expressions arr and &arr same for an array of 10 integers?

a)

Yes

b)

No

9.

Find the output of the following code?

#include<stdio.h>

int main()

{

float f = 0.1;

if (f = 0.3)

printf ("yes");

else printf ("no");

}

a)

Yes

b)

No

10.

What does the following declaration mean?

int (*ptr)[10];

a)

ptr is array of pointers to 10 integers

b)

ptr is a pointer to an array of 10 integers

c)

ptr is an array of 10 integers

d)

ptr is an pointer to array