Full Transcript

C Programming Multiple Choice Questions 1.) Developer of ‘C’ language is ______________. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in ___...

C Programming Multiple Choice Questions 1.) Developer of ‘C’ language is ______________. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in _________________. a.) 1970 c.) 1976 b.) 1972 d.) 1980 3.) C is ______ level language. a.) High c.) Middle b.) Low d.) Machine 4.) C is available for which OS? a.) DOS c.) Unix b.) Windows d.) All of above 5.) Which symbol is used for pre-processor statement? a.) ! b.) # c.) ~ d.) ; 6.) Which of the following is a scalar data type? a.) Float c.) Array b.) Union d.) Pointer 7.) Which of the following are tokens in C? a.) Keywords c.) Constants b.) Variables d.) All of above 8.) Which is the valid range of “int” data type? a.) 0 to 256 c.) -32767 to +32768 b.) -32768 to +32767 d.) No particular range 9.) Which symbol is used to terminate a statement? a.) ! b.) # c.) ~ d.) ; 10.) Which escape sequence character is a line terminator? a.) \a b.) \b c.) \m d.) \n 11.) Which escape sequence character is used to beep from speaker? a.) \a b.) \b c.) \m d.) \n 12.) Character constants should be enclosed between ____________. a.) Single Quotes c.) Both A and B b.) Double Quotes d.) None of these Designed by: Prof. Nirzari Bhayani Page 1 13.) String constants should be enclosed between ____________. a.) Single Quotes c.) Both A and B b.) Double Quotes d.) None of these 14.) Which of the following is invalid? a.) ‘ ’ b.) “ ” c.) ‘a’ d.) ‘abc’ 15.) The maximum length of a variable in C is ______________. a.) 8 b.) 16 c.) 32 d.) 64 16.) The maximum size of ‘float’ variable is ________________. a.) 1 byte b.) 2 bytes c.) 4 bytes d.) 8 bytes 17.) The maximum size of ‘double’ variable is _______________. a.) 1 byte b.) 2 bytes c.) 4 bytes d.) 8 bytes 18.) A declaration of float a; double b; occupies ________ of memory. a.) 1 byte b.) 6 bytes c.) 10 bytes d.) 12 bytes 19.) The size of a string variable is __________. a.) 1 byte b.) 10 bytes c.) 20 bytes d.) Not specific 20.) Which is an example of compounded assignment statement? a.) a=5 b.) a=b c.) a=b=c d.) a+=10 21.) The operator && is used for ________. a.) Value assignment c.) Logical comparison b.) Increment by 1 d.) Condition Checking 22.) The operator & is used for _________. a.) Bitwise AND c.) Pointer to the variable b.) Logical AND d.) None of these 23.) The equality operator is represented by _________. a.) := b.).EQ c.) = d.) == 24.) Operator’s precedence determines which operator is ____________. a.) Faster c.) Take no argument b.) Take less memory d.) Evaluated first 25.) The bitwise AND is used for _______________. a.) Masking c.) Division b.) Comparison d.) Shifting bits 26.) The operator d.) + Designed by: Prof. Nirzari Bhayani Page 2 28.) The associability of = operator is ________. a.) Right to Left c.) None of these b.) Left to Right d.) All of above 29.) Which operator has LOWEST priority? a.) ++ b.) % c.) || d.) () 30.) Which operator has HIGHEST priority? a.) () b.) || c.) % d.) ++ 31.) Integer Division results in ___________. a.) Truncating the fractional part c.) Floating value b.) Rounding the fractional part d.) An error is generated 32.) Which is a Ternary Operator? a.) ? : b.) * c.) sizeof d.) ^ 33.) The typecast operator is ____________. a.) cast () c.) // b.) (data type) d.) “ ” 34.) Explicit type conversion is known as ___________. a.) Separation c.) Conversion b.) Casting d.) Disjunction 35.) a+=4 means ____________. a.) a=a+4 c.) a=4 b.) a+4=a d.) a=4+4 36.) p++ executes faster than p=p+1 because ______________________. a.) p uses registers c.) p++ is a single instruction b.) ++ is faster than + d.) All of above 37.) Which statement is correct? a.) C Library functions provide I/O facilities b.) C inherent I/O facilities c.) C doesn’t have I/O facilities d.) Both (a) and (c) 38.) Header files in C contain ___________. a.) Compiler Commands c.) Header information of C Programs b.) Library functions d.) Operators for files 39.) Which pair is used for single character I/O.? a.) getchar() and putchar() c.) input() and output() b.) scanf() and printf() d.) None of these 40.) The printf() returns __________ value when an error occurs. a.) Positive value c.) Negative Value b.) Zero d.) None of these Designed by: Prof. Nirzari Bhayani Page 3 41.) Identify wrong statement: a.) putchar(65) c.) putchar(“x”) b.) putchar(‘x’) d.) putchar(‘\n’) 42.) An Ampersand in scanf() before the name of a variable denotes ___________. a.) Actual Value c.) Address b.) Variable Name d.) Data Type 43.) Symbolic constants can be defined using _____________. a.) #define c.) symbols b.) const d.) None of these 44.) Null character is represented by _____________. a.) \n b.) \0 c.)\o d.)\e 45.) Which header file is essential for using strcmp() function.? a.) string.h c.) text.h b.) strings.h d.) strcmp.h 46.) malloc() used in Dynamic Memory Allocation is available in ____________. a.) stream.h c.) alloc.h b.) malloc.h d.) stdio.h 47.) Testing & Conversion character functions in C are available in ____________. a.) ctype.h c.) math.h b.) string.h d.) conio.h 48.) C supports ________ Looping statements. a.) 5 b.) 3 c.) 6 d.) 8 49.) A statement differs from an expression by terminating with a _________. a.) Semicolon (;) c.) NULL b.) Colon (:) d.) dot (.) 50.) Which of the following is an unconditional control structure? a.) Do-while c.) goto b.) if-else d.) for 51.) Which of the following is a keyword is used for a storage class.? a.) printf c.) auto b.) external d.) scanf 52.) In C language ‘a’ represents ______________________. a.) a digit c.) a character b.) an integer d.) a word 53.) The number of Arithmetic operators in C language is ____________. a.) 4 b.) 5 c.) 6 d.) 7 54.) How many keywords are available in ‘C’? a.) 32 b.) 34 c.) 36 d.) 30 Designed by: Prof. Nirzari Bhayani Page 4 55.) Advantage of UNION over STRUCTURE is _______________. a.) Memory Storage c.) Memory Screen b.) Memory Location d.) None of these 56.) Maximum number of elements in the array declaration “ int arr; ” is ________. a.) 28 b.) 32 c.) 35 d.) 40 57.) Array subscripts in C always start at __________. a.) 1 b.) -1 c.) as per programmer d.) 0 58.) Which is the correct way to declare a pointer? a.) int ptr; b.) *int *ptr; c.) int *ptr; d.) *int ptr; 59.) Output of the printf(“2.3f\n”,17.23478) will be _____________. a.) 17.23478 c.) 17.2348 b.) 17.235 d.) 17.23 60.) What will be the value of the following: 1. floor(5.8) 2. floor(-5.8) a.) -5,-6 c.) -5,6 b.) 5, -6 d.) 5,6 61.) What would be the value of X after execution of the following statements? int x,y=10; char z=’a’; x=y+z; a.) Invalid c.) 107 b.) 17 d.) 10a 62.) What will be the output the following: #include #include void main() { int *i, *j, a=12, b=2, c ; c= (a=a+b, b=a/b, a=a*b, b=a-b); i= &c; printf (“%d”,--(*i)); } a.) 93 c.) 91 b.) 92 d.) 90 63.) Study the following program: #include #include void main() { int a=7,b=5; switch(a/a%b) { Designed by: Prof. Nirzari Bhayani Page 5 case 1: a=a-b; case 2: a=a+b; case 3: a=a*b; case 4: a=a/b; default: a=a; } printf(“%d”, a); } What will be the output? a.) 7 b.) 5 c.) 2 d.) None of above 64.) A ________ operator applies to two operands, while a _______ operator applies to a single operand. a.) Binary, Unary c.) Unary, Ternary b.) Ternary, Binary d.) None of these 65.) A ________ is a place where we can store values. Size of INT is ____________ bits. a.) int, 2 c.) variable, 16 b.) variable, 2 d.) int, 16 66.) Variable consist of letters, numbers and _________________. You can’t use ___________. a.) Underscore, keyword c.) Identifier, keyword b.) Alphabets, underscore d.) Underscore, identifier 67.) Study the following C program: #include #include void main() { char *str1,*str2,*str3; str1=”India is my”; str2=”!!yrtnuoC”; str3=”Gujarat”; clrscr(); strncat(str1,strrev(str2),strlen(str3)); puts(str1); } What will be the value of STR1 after execution of the above program? a.) India is my Country!! b.) India is my !!yrtnuoC c.) India is my Country d.) None of these 68.) Study it: #include #include void main() { int count=1,digit=0; while(digit

Use Quizgecko on...
Browser
Browser