You are on page 1of 11
Indio Bs" (Search Home Aptitude Logical Verbal CA Current Affairs GK Engineering Interview Online Tests Puzzles Online C Programming Test C Programming Test 4 Home » Online Test » Online C ‘Test » C Programming Test 4 Marks 720 “Total aumber of questions Number of answered questions ‘Number of unanswered questions ‘Test Review : View answers and explanation for this test. 1, How many times "IndiaBIX” is get printed? #includecstdio.h> Jn ming 5 xca10; x44) f(x <5) continues else breaks 4 Prinee"andtaan); ) return 8 A Infinite times 2 B.1 times C.0 times® D.10 times % Your Answer: Option (Not Answered) Correct Answer: Option C Learn more problems on : Control Instructions Discuss about this problem : Discuss in Forum 2.What will be the output of the program? Hincludecstdio.h> int main() Ant 4a-3, J02, ke, ms vel Ba ve} I] teks printf("%d, 4, Xd, Rd\n", i, J, ky ms Feturn 85, y ALL,2,0,1% B.-3,2,0,1% €.2,3, 0,18 nips:w.indiabhx.comvoriine-teste-programming-test/14 am rrear2019 Test Result D2, 3,1, 1% ‘Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Step 1: int i=-3, j=2, K=O, m; here variable i,j,k, m are declared as an integer type and variable i j,k are initialized to -3, 2,0 respectively, Step 2: m= +41 && +4) || +k: becomes m = (-2 dee 3) || 4+k: ‘becomes m = TRUE || +¥k:. (G+) is not executed because (-2 && 3) alone retum TRUE. Hence this statement becomes TRUE, So it returns I'(one), Hence Step 3: priny{("¥ad, Yd, Yo, Yd ,j km): Inthe previous step the value of ij are incremented by "I'(one). Hence the output is *-2, 3,0, 1" Learn more problems on : Expressions Discuss about this problem : Discuss in Forum 3.What will be the output of the program? Hincludecstdio.h> int addmult(int 44, int 33) © ane kee 1 Wee al + dys Ths it 335 return (kk, 11); int main() int 193, jo4, ky 15 kes addnule i, 4): Ls addmult(s, 9 ‘Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Step 1: int 1, k, 1: The variables i, ‘The function addmult(i, j); accept 2 integer parameters. Step 2: k iddmult(i,j); becomes k = addmul(3, 4) In the function addmult). The variable kk, I! are declared as an integer type int kk, Hl; i ii + jf; becomes kk = 3 + 4 Now the kk value is "7. I= ii * jj becomes Il = 3 * 4 Now the H! value is "12. return (kk, 1); Wereturs the value of variable /! only, ‘The value 12 is stored in variable ‘e’, Step 3:1 = addmult(i,j); becomes ! = addmult(3, 4) hitps:lwwwindlabx.convonline-teste-programming-test14 kare declared as an integer type and variable i,j are initialized to 3, 4 respectively, am rrear2019 Test Result kk = ii + jf: becomes kk = 3 + 4 Now the kk value is "7. I= ii * jj; becomes Il = 3 * 4 Now the I! value is "12, return (kk, I); Kt retums the value of variable It only. ‘The value 12 is stored in variable 7, Step 4: pring(("9ed, Yadin", kD: It prints the value of k and / Hence the output is "12, 12" Learn mote problems on : Functions Discuss about this problem : Discuss in Forum 4.Will the following program print the message infinite number of times? #includecstdio.h> ‘define INFINITELOOP while(3) int main() INFINITELOO® printf("indiaBIx") ; return 85 y AYes@ B.Nox Your Answer: Option (Not Answered) Correct Answer: Option A Explanati Yes, the program prints "indiaBIX” and runs infinitely. ‘The macto INFINITELOOP while(1) replaces the text INFINITELOOP' by ‘while(1) In the main function, while(1) satisfies the while condition and it prints "IndiaBIX". Then it comes ta while(1) and the loop runs infinitely. ‘Leam more problems on : C Preprocessor Discuss about this problem : Discuss in Forum 5, What will be the output of the program ? includecstdio.h> int *check(static int, static int); int main() { int *e5 © = check(16, 20); print("x4\n", ¢); » eum es An teheck(stetic int 4, static nt 3) int *p, P= 8; 4 8 Hei >= 45) se @tH8 (PD return (4); Al0x B.20% C.Error: Non portable pointer conversion ® D.Error: cannot use static for function parameters® hitps:lwwwindlabx.convonline-teste-programming-test14 sit 7ear2019 ‘Tost Result Your Answer: Option (Not Answered) Correct Answer: Option D Lear more problems on : Pointers Discuss about this problem : Discuss in Forum 6. Ifthe size of integer is Abytes, What will be the output of the program? #ineludecstdio.to Ant main() Ant arr{] = (22) 13) 14, 15, 16) Drank (Rd, Ha, NAV, Sizeofare), sizeot(rare, sizeof(are(e)); A.10, 2, 426 B.20,4,4@ C.16, 2,23 D.20, 2,2% ‘Your Answer: Option (Not Answered) Correct Answer: Option B Leam more problems on : Pointers Discuss about this problem : Discuss in Forum 7.1m the following program add a statement in the function fact() such thatthe factorial gets stored in j. includecstdio.h> void fact(int*}; int main() 4 int i255 fact(ai); printe("a\n", 1); Peturn @; y void fact(int *j) q static int set; Hes) fact); | Pada a statesent here */ Your Answer: Option (Not Answered) Correct Answer: Option B Leam more problems on : Pointers Discuss about this problem : Discuss in Forum 8. What will be the output of the program ifthe array begins at address 65486? f#ineludecstdio.to int main() fn arr{] = (12, 14) 15, 23, 45)5 hitps:lwwwindlabx.convonline-teste-programming-test14 am rrear2019 Test Result printf("%u, Mu\n", arr, arr); return @; 1p 6s486,osasee B.65486, 654860 65486, 65490 1.65486, 65487 Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Step 1: int arr{] = (12, 14, 15, 23, 45}; The variable arr is declared as an integer array and initialized. Step 2: prinif("ou, Youn", arr, arr); Here, The base address of the array is 65486, => ar, &arr is pointing to the base address ofthe array arr. Hence the output of the program is 65486, 65486 Leam more problems on : Arrays Discuss about this problem : Discuss in Forum 9.What will be the output of the program ? ‘Hincludeestéio.h> int main() int 45 char al] = iF(printf("%s", 2) yeabrinttC Te string ts eapty\n") printf("The string 4s not empty\n"); return 8; A.The string is empty B.The string is not empty CNo output ® Dox ‘Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: ‘The function printf) returns the number of charecters printed on the console. Step 1; char af] = "0; The variable a is declared as an array of characters and it initialized with "\0". It denotes that the string is empty. Step 2: ifiprin/("s",a)) The priny/ statement does not print anything, soit returns ‘0'(zero). Hence the if condition is failed. In the else part it prints "The string is not empty”. Learn mote problems on : Strings Discuss about this problem : Discuss in Forum 10.What will be the output of the following program in 16 bit platform assuming that 1022 is memory address ofthe string "Hellol" (in Turbo C under DOS) ? #includecstdio. ho Ant main() 4 hitps:lwwwindlabx.convonline-teste-programming-test14 sit rrear2019 Test Result printf("u Xs\n", &*Hellot", &*Hel102"); return @; y A102 Hello2@ B.Hellol 1022% C.Hellot Hello2 x D,1022 1022% E.Error% Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: In pringf("%u %s\n", & "Hello", & Hello”); ‘The %u format specifier tells the compiler to print the memory address ofthe "Hello!". The %s format specifier tells the compiler to print the string "Hello2*, Hence the output of the program is "1022 Hello2". Leam more problems on : Strings Discuss about this problem : Discuss in Forum 11.{f char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes? struct ex { char chs int $5 long int ANes x B.No@ Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: ‘A compiler may leave holes in structures by padding the first char inthe structure with another byte just to ensures that the integer that follows is stored at an location. Also, there might be 2extra bytes after the integer to ensure thatthe long integer is. stored at an address, which is multiple of 4. Such alignment is done by machines to improve the efficiency of accessing values. Leam more problems on : Structures, Unions, Enums Discuss about this problem : Discuss in Forum 12. Point out the error/warning in the program? #includecstdio.h> Ant main() € unsigned char ch; FILE "#3, fp=fopen(*trial", "e") whie((ch printf("Ke", ch); felose(p); return 85 A.Error: in unsigned char declaration B.Error: while statement C.No error x Dilt prints all characters in file "x ‘Your Answer: Option (Not Answered) hitps:lwwwindlabx.convonline-teste-programming-test14 emt rrear2019 Test Result 13, 4 Correct Answer: Option A Explanation: Here, EOF is -1. Asch’ is declared as unsigned char it cannot deal with any negative value. Lear more problems on : Input / Output Discuss about this problem : Discuss in Forum What will be the output of the program Hincludecstdto.h> void fun(int); Ant main(int argc) print®("xd *, argc); Fun(arge) return 85 y void fun(int 4) 1#(1=4) main(+si); A123% B.12340 C.234% DIX ‘Your Answer: Option (Not Answered) Correct Answer: Option B Leam more problems on : Command Line Arguments Discuss about this problem : Discuss in Forum Which of the following statements are correct about the program? ineludecstdio.h> Aint main() t Unsigned int nun; int 1; scanf("Xu", nun); for(ieo; 1”16; 44+) printe(Rd, (numecs & 2¢<15)?2:8)5 return 0; A It prints all even bits from num > Bilt prints all odd bits from mum Clt prints binary equivalent num@ D.Error x Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: If we give input 4, it will print 00000000 60000100 ; If we give input 3, it will print 00000000 00000011 ; If we give input $11, it will print 00000001 T1I11111 ; Lea more problems on : Bitwise Operators Discuss about this problem : Discuss in Forum hitps:lwwwindlabx.convonline-teste-programming-test14 mm rrear2019 Test Result 15. 16. 17. 18, What will be the output of the program? Hincludecstdio.h> int fun(int **ptr); int main() { int 1-10; ‘const int *ptr = &i; fun ptr); return 85 int fun(int **ptr) Ant j= 223; int *temp =’ 83; rintf("Before changing ptr = XSx\n", *ptr); const *ptr = temp; printé(*Aafter changing ptr = X5x\n", *ptr); return 83 Address of AY "Address of sd Baga Error: cannot convert parameter I from ‘const int ** to ‘int *#@ D.Garbage value» ‘Your Answer: Option (Not Answered) Correct Answer: Option C ‘Leam more problems on : Const Discuss about this problem : Discuss in Forum ‘Can 1 increase the size of dynamically allocated array? AYes@ BNox ‘Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Use realloc(variable_name, value); Leam more problems on : Memory Allocation Discuss about this problem : Discuss in Forum It is necessary to call the macro va_end if w_start is called in the function AYes@ BNox ‘Your Answer: Option (Not Answered) Correct Answer: Option A Leam more problems on : Variable Number of Arguments Discuss about this problem : Discuss in Forum ‘What do the following declaration signify? void (t099)05 . ‘A.omp isa pointer to an void function type. B. cmp isa void type pointer function. C.cmp is a function that retum a void pointer. D.emp isa pointer to a function which returns void .© hitps:lwwwindiabix.convonline-teste-programming-test14 am rrear2019 Test Result 19. 20. Your Answer: Option (Not Answered) Correct Answer: Option D ‘Leam more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum ‘What will be the output of the program (in Turbo C under DOS)? fineludecstdio.h> Aint main() { char huge Snear *far *ptrt; char near *far thuge *ptr2; char far *huge *near *ptr3; printf("%4, 4, %d\n", sizeof(ptri), sizeot(ptr2), sizeof(ptr3)); return @; » nsaex B.2,4,4x C4,4,20 D2,4,8x ‘Your Answer: Option (Not Answered) Comtect Answer: Option C Leam more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum ‘What will be the output of the program? Bincludecstdio.h> BincludecstdLib.ho int main() q char *4 = "55.555"; Ant resulta = 10; Float result2 = 11.111; resulttvatoi (1): result2ratof( printf("Xé, X€*, resultt, result2); return @; ASS, 55.555 B. 66, 66,666600 x C.65, 66.6660000 D.S5, 55% Your Answer: Option (Not Answered) Comect Answer: Option C Explanation: Function atoi() converts the string to integer. Function atof() converts the string to float. result] = result! +atoi(): Here result = 10 + atoi(55.$55); resultl = 10 +55; result! = 65; result2 = result2-atoft): Here result2 = {1.111 + atof(55.555); result2 = 11.111 + $5.555000; result2 = 66.666000; So the output is "65, 66.666000" hitps:lwwwindlabx.convonline-teste-programming-test14 om rrear2019 Test Result Leam more problems on : Library Functions Discuss about this problem : Discuss in Forum We Pay Fair Som Prices Get C IT Help Desk Software i Best IT HelpDesk Programming Test- Digital Trends in 2019 Number puzzles - For Software Random - Online C Interviews, Placement, Programming Test Competitive and... Magee indabinco 6 asin indica - + ED ED>| = 4 4+ e ae D> Sh os *.e ¥e of DIF! 0 Jy u The Book on Making — Computer Science Test B: understanding - Problems on Money -Random Online Body Language Aptitude Que Computer Science Test Answers 0 stoaangecom indabicom indbiacom indsbia.com ¥** END OF THE TEST *** Feedback Quality ofthe Test :(=Select= + Difficulty ofthe Test : Select= + ‘Comments: ‘Submit Feedback Current Affairs 2019 Interview Questions and Answers nips:w.indiabhx.comvoriine-teste-programming-test/14 som rrear2019 Test Result ‘Stop Eviction No Outlays Solis or agentes ox Best IT HelpDesk Software 10000 succesful Help Desks use SerceDesk Pls to Supercharge thr IT Helo Desk © 2009 - 2019 by IndiaBIX™ Technologies. All Rights Reserved. | Copyright| Terms of Use & Privacy Poli Contact us: info.india- @ -bix@gma@il.com nips:w.indiabhx.comvoriine-teste-programming-test/14 wt

You might also like