
Instruction:
- This is a FREE online test. DO NOT pay money to anyone to attend this test.
- Total number of questions : 20.
- Time alloted : 20 minutes.
- Each question carry 1 mark, no negative marks.
- DO NOT refresh the page.
- All the best :-).
1. | How many times "IndiaBIX" is get printed?
|
|||||||||||||||||||
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?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Step 1: int i=-3, j=2, k=0, 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 = ++i && ++j || ++k; Step 3: printf("%d, %d, %d, %d\n", i, j, k, m); In the previous step the value of i,j are increemented by '1'(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?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Step 1: int i=3, j=4, k, l; The variables i, j, k, l are declared as an integer type and variable i, j are initialized to 3, 4 respectively. The function addmult(i, j); accept 2 integer parameters. Step 2: k = addmult(i, j); becomes k = addmult(3, 4) In the function addmult(). The variable kk, ll are declared as an integer type int kk, ll; kk = ii + jj; becomes kk = 3 + 4 Now the kk value is '7'. ll = ii * jj; becomes ll = 3 * 4 Now the ll value is '12'. return (kk, ll); It returns the value of variable ll only. The value 12 is stored in variable 'k'. Step 3: l = addmult(i, j); becomes l = addmult(3, 4) kk = ii + jj; becomes kk = 3 + 4 Now the kk value is '7'. ll = ii * jj; becomes ll = 3 * 4 Now the ll value is '12'. return (kk, ll); It returns the value of variable ll only. The value 12 is stored in variable 'l'. Step 4: printf("%d, %d\n", k, l); It prints the value of k and l Hence the output is "12, 12". Learn more problems on : Functions Discuss about this problem : Discuss in Forum |
4. | Will the following program print the message infinite number of times?
|
|||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Yes, the program prints "IndiaBIX" and runs infinitely. The macro 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 to while(1) and the loop runs infinitely. Learn more problems on : C Preprocessor Discuss about this problem : Discuss in Forum |
5. | What will be the output of the program ?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Learn more problems on : Pointers Discuss about this problem : Discuss in Forum |
6. | If the size of integer is 4bytes, What will be the output of the program?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Learn more problems on : Pointers Discuss about this problem : Discuss in Forum |
7. | In the following program add a statement in the function fact() such that the factorial gets stored in j.
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Learn more problems on : Pointers Discuss about this problem : Discuss in Forum |
8. | What will be the output of the program if the array begins at address 65486?
|
|||||||||||||||||||
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: printf("%u, %u\n", arr, &arr); Here, The base address of the array is 65486. => arr, &arr is pointing to the base address of the array arr. Hence the output of the program is 65486, 65486 Learn more problems on : Arrays Discuss about this problem : Discuss in Forum |
9. | What will be the output of the program ?
|
|||||||||||||||||||
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 a[] = "\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: if(printf("%s", a)) The printf() statement does not print anything, so it returns '0'(zero). Hence the if condition is failed. In the else part it prints "The string is not empty". Learn more 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 of the string "Hello1" (in Turbo C under DOS) ?
|
||||||||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: In printf("%u %s\n", &"Hello", &"Hello");. The %u format specifier tells the compiler to print the memory address of the "Hello1". The %s format specifier tells the compiler to print the string "Hello2". Hence the output of the program is "1022 Hello2". Learn more problems on : Strings Discuss about this problem : Discuss in Forum |
11. | If a 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?
|
|||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: A compiler may leave holes in structures by padding the first char in the 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 that the 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. Learn more problems on : Structures, Unions, Enums Discuss about this problem : Discuss in Forum |
12. | Point out the error/warning in the program?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Here, EOF is -1. As 'ch' is declared as unsigned char it cannot deal with any negative value. Learn more problems on : Input / Output Discuss about this problem : Discuss in Forum |
13. | What will be the output of the program
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Learn more problems on : Command Line Arguments Discuss about this problem : Discuss in Forum |
14. | Which of the following statements are correct about the program?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: If we give input 4, it will print 00000000 00000100 ; Learn more problems on : Bitwise Operators Discuss about this problem : Discuss in Forum |
15. | What will be the output of the program?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Learn more problems on : Const Discuss about this problem : Discuss in Forum |
16. | Can I increase the size of dynamically allocated array? |
|||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Use realloc(variable_name, value); Learn more problems on : Memory Allocation Discuss about this problem : Discuss in Forum |
17. | It is necessary to call the macro va_end if va_start is called in the function. |
|||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Learn more problems on : Variable Number of Arguments Discuss about this problem : Discuss in Forum |
18. | What do the following declaration signify?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Learn more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum |
19. | What will be the output of the program (in Turbo C under DOS)?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Learn more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum |
20. | What will be the output of the program?
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation:
Function atoi() converts the string to integer.
result1 = result1+atoi(i);
result2 = result2+atof(i); Learn more problems on : Library Functions Discuss about this problem : Discuss in Forum |