Thursday, December 6, 2007

quiz 1 unit 1 & 2 continuation

81. C language has been developed by
a) Peter Norton b) martin Richards c) Ken Thomson d) Dennis Ritchie
82. The constant ‘\b’ is used for
a) tab b) backspace c) bell d) vertical blank
83. In the following which one is not a “c” key word
a) case b) choice c) volatile d) for
84. The size of operator returns the size of an operand
a) in bits b) in words c) in bytes d)in float
85. The value of 2%5 is
a) 3 b) 10 c) 0 d) 2
86. && and || are which kind of program
a) arithmetic b) logical c) bitwise d) assignment operator
87. consider the following program
main( )
{ int a=2;
printf(“%d”,a);
modify(a);
printf(“%d”,a);
}
void modify(int a)
{
d=a*3;
printf(“%d”,a);
return; }
the out put of the above program is
a) 2 66 b) 626 c) 66 2 d) 262
88. Float c, c=25/2; what is the value of c
a) 12.500000 b) 12 c) 12.0 d) 12.00000
90. Give the output of the following program
#include
main( )
{ int a, count;
int funct(int count);
for(count=1; count<=5; ++count)
{ a=funct 1(count);
printf(“%d”,a);
}
int funct(int count)
{ int y;
y=x*x;
return(y);
}
a) 1 , 4, 9, 16, 25 b)25 c) 36 d) 25, 9, 16
91. main ( )
{ }
int a;
fun1( ){ }
fun2( ){ }
To which of the above functions, int a is available to
a) available to neither of the function b) all functions
c) only fun1( ) d) both fun1( ) and fun2( )
92. The function sqrt of ----heder file
a) math.c b) iostream.h c) stadio.h d) conio.h
93. what is the range of char data value?
a)-128 to 127 b)-64 to 64 c) 0 to 255 d) -127 to 128
100. main( )
{
int a =0;
if (a) printf(“%d”,a+=2);
} the out put is
a) 3 b) 1 c) 2 d) 0
101. Int data type occupies------ no.of bytes.
a. 2bytes b. 4bytes c. 16bytes d. 32 bytes
102. Short int occupies---------- bits.
a. 8bits b.16bits c. 32bits d. 64bits
103. Evaluate 2%3*5+6/2* -----
a. 0 b.13 c. 3 d. 8
104. Out put of inta=10;printf(“%f”,a); is-----
a. 10 b.10.0 c. 0 d. error
105. Out of int a; a=5>6; if (a) printf(“you”)else printf(“me”);-----
a. you b. me c. youme d. error
106. Out put of int x=5, y; y=(x>5?3:4);-----------
a. 5 b. 3 c. 4 d. 0
107. Out put of int x=10; char y;------------
y=(x= =10? ‘A’ : ‘B’ );printf(“%d”,y);
a. 10 b. A c. B d. 65
108. Value of k is, float i=10.0,k; k=i%2------------
a. 0 b. 0.0 c. 1 d. error
109. I=I+1 is equal to -------
a. I++ b. ++I c. I+=1 d. all of above
110. Out put of : printf(“ %d”, size of (‘8’));
a. 8 b. 1 c. 2 d. 4
111. Loop Statements.
a. for b. while c. do…while d. all of above
112. C is
a. operating system b. package c. compiler d. dbms
113. & is a unary operator
a. true b. false

114. Format code %s is used for
a. int b. character c. string d. float
115. Range of int data type.
a. -32768 to 32767 fixed b. -128 to 127
c. Depending on the compiler d. infinite
116. char data type occupies____no. of bytes
a. 8 bits b. 18 bits c. 1 bit d. 32 bits
117. Standard keywords in ‘C’ is
a. 16 b. 32 c. 64 d.128
118. Pick out the valid variable
a. simple. Interest; b. simple interest
c. simple-interest d. simple_interest
119. In the following which is not a valid variable
a. stu.name; b. _stu_name;
c. stu_name; d. stu_name1;
120. What would be the output of the following
int i=32769; printf(“%d”,i);
a. 32767 b. 0 c.-32767 d. Error

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

Monday, December 3, 2007

why this blog

it will contain jntu online exam sample questions database. Initially planning to post CPDS subject database and gradually add other subjects. It will not have the solutions, the reason being students should try the answers on the system or textbooks.The questions are being prepared with the able support of my staff(Mr.satish,Mr.praveen,Ms.Afroz,Ms.Nagarani and my students at Gnyana saraswati college of Engineering and Technology, nizamabad. Some questions are out of syllabus like questions on arrays and string which can be ignored for the I quiz but can be referred for the II quiz.

Happy Online!