Thursday, December 6, 2007

cpds quiz 1 Unit 1 and 2

1). which of the following operators is not used ---
a) >> b) > c) x d) &

2). which of the following in not a keyword ----
a) Constant b) signed c) typedef d) register

3). A machine language program consists of instructions written in
a) English like words b) keywords
b) mnemonics d) 0’s and 1’s

4). which function is used to convert a string of digits into their integer values
a) itoa b) atoi c) asctoint d) btoi

5). the names of actual parameters and formal parameters are
a) Almost same b) should be same c) always same d) need not be same

6). the symbol for right shift operator is
a) <- b) -> c) >> d) >

7). Which of the following is shorthand operator for a= a % b
a) a =% b b) a % b c) a %= b d) a %b =a

8). In the following is which on is not a c keyword?
a) case b) for c) volatile d) choice.

9). Pseudo code is
a) Language independent code b) code developed using the syntax of a special -
-language c) refined version of program d) out come of compilation process

10). The escape sequence ‘\t’ is a
a) next line . b) next column c) backspace d) tab

11). What is the value of !0?
a) 1 b) 00 c) 0 d) -1

12). If a=15 then b=a<<2 will results
a) b=3 b) b=30 c) b =7 d) b=6

13). in the expression b=6.6/9+ (2*a+ (3*c)/a*d)/ (2/n); which operation will be
performed first

a) 6.6/9 b) 2*a c) 2/n d) 3*c

14). what is the output of the program
main( )
{
int a=123;
int r, rev;
while (a>0)
{
a=a%10;
rev=rev*10+a;
a=a/10;
}

}

a) 123 b) 3 c) 321 d) 30201

15). which of the following shows the correct hierarchy of arithmetic operations
In ‘c’
a) ( ), / or *, - or +
b) ( ), &&,* or /, + or –
c) ( ), &&,*, /,+, -
d) ( ),&&, /,*,+,-

16). What is the result of the expression (10/3)*3+5%3?

a) 10 b) 11 c) 8 d) 1

17). The symbol for exclusive OR operator is

a) ~ b) / c) & d) ^

18). Which of the following is used in to indicate logical OR

a) U b) || c) V d) /

19). Addition of two numbers is performed using
a) logical operators b) conditional operator c) relational d)arithmetic
20). Int a=13, b=7, c;
c=a&b; what is the value of c

a) 0000 0000 0000 0110 b) 0000 0000 0000 0100
c) 0000 0000 0000 0101 d) 0000 0000 0000 0101

21). Among the following operators which operators has the highest priority

a) Bitwise XOR b) logical OR c) logical AND d) bitwise OR

22). The number of loop constructs in c is

a) 3 b) 4 c) 5 d) 2

23). An array can have ----- dimension(s)

a) three b) single c) multiple d) double

24). Which of the following is a string

a) ‘abcd b) “abcd” c) abcd d) ‘abcd”

25). Consider the array definition int num[10]={3,3,3}; pick the correct answers
a) this is syntactically wrong b) the value of num[8] is 3
c) this is invalid if it comes within a function d) the value num[2] is 3

26). Literal means

a) character b) A string c) A string constant d) An alphabet

27). The parameters in a function definition are

a) Actual parameter b) dummy parameter
c) real parameters d) formal parameter

28). Array elements are stored in
a) scattered memory location b) sequential memory locations
c) direct memory location d) random memory locations


29). Consider scanf(“%2d”, &n), and the input data

a) 31.42 b) 42 c) 31 d) error

30). which is syntactically correct;

a) if (a,eq 10){;} else if(a<10){;} b) if(a:-10){;} else if(a<10){;}

c)if(a—10){;} else if(a<10){;} d) if(a.eq.10){;} else if(a<10){;}


31). The output of the statement printf(%d”,0xdc)is----

a) 420 b) 320 c) 120 d) 220

32). A character array is terminated internally with

a) Space b) ‘\0’ c) 0 (d) ;

34). The operators *, ||, <, = if arranged in the ascending order of precedence reads

a). =, ||, <,* b) *, ||, =, < c) <, ||, =, * d) =, <, ||, *

35). The following program
main( )
{
static int a[]={7, 8, 9};
printf(“%d”, a[2]=2[a]+a[2]);
}

a) will compile successfully b) results in segmentation error
c) result in bug error d) runtime error

36). The process of removing a bug is known as

a) running b) execution c) debugging d) compilation

37). Identify the unconditional control structure

a) switch-case b) goto c) if d) do- wile

38). The function used to find the length of the string

a) strrev( ) b) strint( ) c) stracat( ) d) strlen( )

39). Which of the following is the symbol for preprocessor

a) < > b) # c) & d) *


40). How many variables of the same type can be initialized at a time with the same value


a) any no.of variables b) one c) two d) three

41). What will be the final value s of x and y?
# include
main( )
{
int x=1,y=1;
do while (y<=s);
printf(“\n x=%d =%d”, x,y);

a) x=6 , y=9 b) x=9,y=6 c) x=6,y=6 d) x=9 , y=9
42). For the array declaration int[s]; what is the amount of storage required?

a) 20 bytes b) 5 bytes c) 10 bytes d) 5 bytes

43). main( )
{
int a=5, float b=10 ,c;
c=b%a;
printf(“%f”, c)
} out put is ------------

a) 0.00000 b) gives an error c) o.oo d) 2.0


44). Which of the following statement is not true about the switch statement .

a) in switch( ) case statement nested if can be used
b) character constants are automatically converted in to integer
c) the switch( ) can evaluate relational or logical expression
d) no two case


45). “void” means -----

a) Something not known b) 0 c) 1 d) nothing

46). A string in the ‘c’ language is represented by enclosing a sequence of characters in

a) flower brackets b) double quotes c) parenthesis d) single quoets


47). The operator % yields

a) fractional part b) remainder after integer division
c) quotient value d) percentage value

48). Which of the following is correct way of defining a symbolic constant pie in c

a)# define pie 22/7 b) # difine pie -22/7 c) #difine 22/7 d) #difine pie -3.142

49).In the following c-statement what is the datatype of d and st respectively
printf (“%d\t% s\n”, d,st);
a)string, string b) character ,string c) digit, string d) digit,int

50). X=9-(12/3) +3*2)-1 what is the value of x

a) 2 b) 10 c) -2 d) 8

51). The declaration of a variable should be done

a) before using it b) after using it c) at the time using it d) only in the calling program

52). Identify the relational operator in c

a) || b) && c)! d) <

53). what is the out put
int j=5;
printf(“%d%d%d”,j,--j,j--);

a) 5 4 3 b) 3 4 4 c) 3 4 5 d) 3 3 5

54). What would be the output of the following
char c=8;
c>>=1&&!0;
printf(“%d”,c);

a) 0 b) 1 c) 4 d) 8

55). Pick out the valid one

a) a=10=b=c; b) a=b=10=c; c) a=b=c=10; d) 10=a=b=c;

56). what would be the out put of the following
int a=10;
printf(“%f”,a);

a) 10 b) 10.0 c) 0 d) error at execution time

57). What would be the output of the following
int I=-3,j=-2k=0,m;
M=++I&&++j||++k
Printf(“\n %d %d”, k,m);

a) 1 1 b) 0 1 c) 1 0 d) 0 0

58). What would be the output of the following
int i=5,j=0,k,l;
k=i&&j;
l=i||j;

a) 0 0 b) 0 1 c) 1 0 b) 1 1

59). What would be the output of the following
if(1)
printf(“CSE”);
else
printf(“Department”);

a). CSE b) department c) CSE Department d) error

60). What would be the out put of the following
int I,j;
for(I=1,j=2;i<=2;I++,j--)
printf(“%d %d”, I,j);

a) 1 1 2 2 c) 1 2 2 2 d) 1 2 2 1 e) 1 2 1 2

64).How many while statements are possible in do – while loop;

a) 2 b) 3 c) 1 d) any number
65).The statement that prints out the character set from A-Z is an integer variable

a) for (a=’a’; a<=’Z’, a++)print(%c”,a);
b) for (a=’A’; a<=’Z’,a++)printf(“%c”,a);
c) for (a=’A’ a<=’z’,a++)printf(“%c”,a);
d) for (a=’A’a<=’Z’,a++)printf(“%c”,a);

66). The error in a program is called

a) flow b) bug c) virus d) vaccine

67). The ANSI C standard recognize maximum length of a variable up to

a) 31 character b) unlimited char c) 8 char d) 15 char

68). The no.of a variables, functions, arrays, are krown as

a) keywords b) identifiers c) names d) elements

69). Switch (ch)
{
case ‘a’: printf(“a”);
case ‘b’:printf(“b”);
default: printf(“error”);
}
if char is assigned to the character ‘a’ then the output will be

a) ab b) ab error c) a d) error

70). When both called function and calling function are same then the process
is said to be

a) synchronization b) modularity
c) recursion d) concurrency

71). The effect of shifting a variable to the left by one bit position is

a) add it by 2 b) mul it by 2 c) div it by 2 d) sub it by 2

72) which of the following is not a keyword

a) enum b) storage c) signed d) register


73) what is the size of long double variable

a) 8bytes b) 10 bytes c) 16 bytes d) 4bytes

74) The function definition contains code for the function

a)true b)false

75) Variables defined within a block have global scope

a)true b)false

76) Top-down design means dividing a bigger program into smaller programs

a)true b)false

77) Which of the following is not part of a function header?

a)name b)parameters c)return type d)title


78) Pow(), abs(), sqrt() are standard functions available in math.h

a)true b)false

79) Each C program must have one and only one function called as main()

a)true b)false

80) Function is a data type

a)true b)false

No comments: