Material Content for PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE JULY 2013

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

1.1 In the passage of text, individual words and punctuation marks are known as

A) Constants

B) Keywords

C) Operators

D) Tokens

1.2 Choose the option that contains only valid hexadecimal integers.

A) 0x9F, 0xbcd, 0x1

B) 037, 0xx, 01000

C) 0x561u, 0x9h, 0xdd

D) H9F, HFF, HAA

1.3 Which one of the following are not valid variable names in C?

A) float_int, keyword, A1

B) ANSI, ascii, cpu

C) valid, variable, name

D) None of the above

1.4 What is the output of the following code?

main()

{   static int num=8;

printf(“%d ”,num=num-2);

if(num!=0) main(); }

A) 8 6 4 2

B) Infinite output

C) 6 4 2 0

D) Invalid because main function can’t call itself.

1.5 What is the effect of the following code?

main() { int a[4] = {25, 16};

printf(“%d %d”, a[0] & a[1], a[1]|a[2]) ; }

A) 16 16

B) Syntax error because of invalid operator symbol

C) 25 16

D) Syntax error because of invalid array initialization

1.6 What will be the output of the following code?

main() { int c,d, *p1=&c,*p2=&d, x;

c =10,d =4;

x = –3* – *p2 / *p1 + 5;

printf(“%d ”,x);

}

A) 6

B) Invalid syntax because / * is used for comments.

C) 8

D) Invalid syntax because three binary operators can’t be together in an expression.

1.7 What is the output of the following code?

main(){ int a, b; a=b=4;

b=a++;

printf("%d %d %d %d", a++, --b, ++a, b--); }

A) 5 3 7 3

B) Syntax error

C) 5 4 5 3

D) 6 2 6 4

1.8 When we declare an array

A) Compiler declare array name itself as a constant pointer to base address

B) A continuous file is allocated to store the elements value

C) Index of elements is declared automatically

D) All elements are initialized to zero

1.9 The do…while looping statement

A) is executed only once if the condition is true.

B) is also known as entry-controlled loop.

C) is executed at least once if the condition is false.

D) is unconditional looping statement..

1.10 What will be the output of the following code?

struct { int si;

double d;

float *cp; } s ;

void main() {

sizeof(s)); }printf(“%d, %d, %d”, sizeof(s.d), sizeof(s.cp),

A) 4, 4, 12

B) 8, 2, 12

C) 10, 4, 16

D) 8, 4, 14

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

2.1 #define is known as preprocessor compiler directive.

2.2 The return type of malloc function is void.

2.3 sizeof( ) is a function that returns the size of a variable.

2.4 Only character or integer can be used in switch statement.

2.5 for(i=0; i<5;i++); statement has syntax error because of semicolon at the end.

2.6 Linking is the process of putting together other program file and functions that are required by the program.

2.7 ‘auto’ keyword is used to declare a local variable.

2.8 Algorithm is the graphical representation of logic.

2.9 Size of the pointer variable depends on the data type that it points to.

2.10 Linked list must require continuous memory allocation unlike array.

3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

 QUESTION OPTION 3.1 This concept is borrowed from structure for constructing data type A. long 3.2 Number of operators required in ?: operator B. int 3.3 Data type of argument counter (argc) in command line argument C. union 3.4 Only this symbol is allowed in a valid variable name D. do…while 3.5 Keyword used to indicate global variable E. underscore 3.6 It is the exit controlled looping statement F. getc 3.7 To declare unsigned long integer variable this suffix is used with value G. double 3.8 To insert the comments in the program this symbol is used H. extern 3.9 Return type of ftell function I. array 3.10 This function is used to read a character from a file J. three K. /* L. while M. UL

4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

4.1 Type casting is a ________ operator.

4.2 Array is ________ type of data type.

4.3 ________ is an unconditional jump statement.

4.4 ________ operator is used to compare two entities.

4.5 ________ data structure can grow or shrink in size during the execution of a program.

4.6 A variable declared inside a function is called ________ variable.

4.7 The ________ operator is true only when both the operands are true.

4.8 ________ keyword allows user to define an identifier that would represent an existing data type.

4.9 ________ function is used to move the file position to desired location within the file.

4.10 ________ function is used to change the memory size already allocated run time.