7/31/2019 Spandan1
1/4
SM T. BHAGWATI CHATURVEDI COLLEGE OF ENGI NEERINGSpandan-2012
C-Coding & Debugging
Name: __________________________________ Roll No: ___________ Sect ion: ____
(1) C programming language was developed by
(A) Dennis Ritchie (B) Ken Thompson (C) Ken Thompson (D) Peter Norton
(2) C is a ___ language
(A)High Level (B)Low Level(C)Middle Level(D)Machine Level
(3) What is the valid range of numbers for int type of data?
(A) 0 to 256 (B) -32768 to +32767 (C) -65536 to +65536 (D) No specific range
(4) An integer constant in C must have:
(A)At least one digit (B) digit with decimal (C) both A & B (D) None of above(5) W hich o f the fo l lowing sym bol is used to denote a pre-processor s ta tem ent?
(A) ~ (B) # (C) ! (D) ;
(6) Find out the output for the following code
main( ) {
float a = 5, b = 2 ;int c ;
c = a % b ;printf ( "%d", c ) ; }
(7) Find out the output for the following code
main( ) {
int a = 300, b, c ;if ( a >= 400 )b = 300 ;c = 200 ;printf ( "\n%d ", b ) ;}
(A) 2.5 (B) 1 (C) 2 (D) error
(A) 300 (B) garbage (C) 2 (D) error
7/31/2019 Spandan1
2/4
8) Find out the output for the following codemain( ) {int x = 3, y = 5 ;if ( x == 3 )printf ( "\n%d", x ) ;elseprintf ( "\n%d", y ) ;}
(9) Find out the output for the following code
main( ) {int i = 4, z = 12 ;if ( i = 5 || z > 50 )printf ( "\nDean of students affairs" ) ;elseprintf ( "\nDosa" ) ;}
(10) Find out the output for the following code
main( ){int p = 8, q = 20 ;if ( p == 5 && q > 5 )printf ( "\nWhy not C" ) ;elseprintf ( "\nDefinitely C !" ) ;}
(11) Find out the output for the following code
main( ) {
int j ;while ( j
7/31/2019 Spandan1
3/4
(12) Find out the output for the following code
main( ) {int x = 1 ;while ( x == 1 ){x = x - 1 ;printf ( "\n%d", x ) ;}}
(13) Find out the output for the following code
main( ) {int x = 1 ;while ( x == 1 )x = x - 1 ;printf ( "\n%d", x ) ;}
(14) Find out the output for the following code
main( ) {int x = 4, y, z ;y = - - x ;z = x- - ;printf ( "\n%d %d %d", x, y, z ) ;}
(15) Find out the output for the following code
main( ){int i = 10 ;while ( i = 20 )printf ( "\nA computer buff!" ) ;}
(16) Find out the output for the following code
(A) 1 (B)0 (C) warning (D) error
(A) 0 (B)1 (C) infinite (D) error
(A) 3 3 2 (B)4 3 2 (C) 2 3 3 (D) error
(A) computer buff! (B)infinite loop (C) 10 (D) 20
7/31/2019 Spandan1
4/4
main( ) {int x = 4, y = 0, z ;while ( x >= 0 ){if ( x == y )break ;elseprintf ( %d %d, x, y ) ;x- - ;y++ ;} }
(17) Find out the output for the following code
main( ) {int k, j = 2 ;switch ( k = j + 1 ){ case 0 :printf ( "\nTailor") ;case 1 :printf ( "\nTutor") ;case 2 :printf ( "\nTramp") ;default :printf ( "\nPure Simple Egghead!" ) ;} }
(18) C programs are converted into machine language with the help of
(19) C variable cannot start with
(20) If a is an integer variable, a = 5 / 2 ; will return a value
Answer Shee t
1) _ _ _ _ _ 2) _ _ _ _ _ 3)_ _ _ _ _ 4) _ _ _ _ _ 5) _ _ _ _ _ 6)_ _ _ _ _ 7) _ _ _ _ _ 8)_ _ _ _ _ _ 9)_ _ _ _ _ _ 10)_ _ _ _ _
11)_ _ _ _ 12) _ _ _ _ 13)_ _ _ _ 14) _ _ _ _ 15) _ _ _ _ 1 6)_ _ _ _ 17) _ _ _ _ 18)_ _ _ _ _ 19)_ _ _ _ _ _ 20)_ _ _ _ _
(A) 4021 (B)4031 (C) 1325 (D) error
(A) Tailor (B)Tytor (C) Tramp (D) Pure Sim ple Egghead!
(A) An Editor (B) A compiler (C)An operating system (D) None of the above
(A) Alphabet (B) Number (C) Both A & B (D) None of the above
(A) 2 (B) 2.5 (C) 0 (D) None of the above