##### O Level | July 2010 | M3-R4 (Prog. and Prob. Solving Through ‘C’ Language)

1) By default a real number is treated as a

A) float

B) double

C) long double

D) integer

A

In computing, 'real number' often refers to non-complex floating-point numbers.

It includes both rational numbers, such as 42 and 3/4, and irrational numbers such as pi = 3.14159265... When the accuracy of the floating-point number is insufficient, we can use the double to define the number. The double is the same as float but with longer precision and takes double space (8 bytes) than float. To extend the precision further we can use a long double that occupies 10 bytes of memory space.

2) Which of the following expression is equivalent to ++*ptr?

A) (*ptr)++

B) ++*(ptr)

C) (ptr)*++

D) (ptr)++*

B

3) The default storage class of a ‘C’ variable is

A) auto

B) static

C) extern

D) register

A

4) Which header file should be included to use functions like malloc() and calloc()?

A) memory.h

B) stdlib.h

C) string.h

D) dos.h

B

5) We can combine the following two statements into one using

char *p;
p = (char*) malloc(100);

A) char p = *malloc(100);

B) char *p = (char) malloc(100);

C) char *p = (char*)malloc(100);

D) char *p = (char *)(malloc*)(100);

C

6) How many times "DOEACC" will get printed?

#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("DOEACC");
}
return 0;
}

A) Infinite times

B) 11 times

C) 0 times

D) 10 times

B

7) Which of the following statement is correct about the following program?

#include<stdio.h>
long fun(int num)
{
int i;
long f=1;
for(i=1; i<=num; i++)
f = f * i;
return f;
}

A) The function calculates the value of 1 raised to power num

B) The function calculates the square root of an integer

C) The function calculates the factorial value of an integer

D) None of the above

C

8) In C, if you pass an array as an argument to a function, what actually gets passed?

A) Value of elements in array

B) First element of the array

C) Base address of the array

D) Address of the last element of array

C

9) If a file is open in ‘write’ mode, then

A) If it does not exist, an error is returned

B) If it does not exist, it is created

C) If it exists, then data is written at the end

D) If it exists, error is returned

B

10) Which of the following functions is used to free the allocated memory?

A) remove(var-name);

B) free(var-name);

C) delete(var-name);

D) dalloc(var-name);

B