Which of the following statements are correct about the program? | |||||||||||||||||
Answer: Option A Explanation: This program will result in error "Statement missing ;" printf("x is less than y\n") here ; is added to the end of this statement. Learn more problems on : Control Instructions Discuss about this problem : Discuss in Forum |
| 2. | The modulus operator cannot be used with a long double. | ||||||||
Answer: Option A Explanation: fmod(x,y) - Calculates x modulo y, the remainder of x/y. This function is the same as the modulus operator. But fmod() performs floating point orlong double divisions. Learn more problems on : Control Instructions Discuss about this problem : Discuss in Forum |
| 3. | Which of the following correctly shows the hierarchy of arithmetic operations in C? | ||||||||||||||||
Answer: Option D Explanation: Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction). How Do I Remember ? BODMAS ! Learn more problems on : Expressions Discuss about this problem : Discuss in Forum |
| 4. | What will be the output of the program? | ||||||||||||||||
|
| 5. | If the size of integer is 4bytes. What will be the output of the program? | ||||||||||||||||
|
| 6. | What will be the output of the program ? | ||||||||||||||||
Answer: Option D Explanation: printf(5+"Good Morning\n"); It skips the 5 characters and prints the given string. Hence the output is "Morning" Learn more problems on : Strings Discuss about this problem : Discuss in Forum |
| 7. | What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input? | ||||||||||||||||
Answer: Option D Explanation: Step 1: void fun(); This is the prototype for the function fun(). Step 2: fun(); The function fun() is called here. The function fun() gets a character input and the input is terminated by an enter key(New line character). It prints the given character in the reverse order. The given input characters are "abc" Output: cba Learn more problems on : Strings Discuss about this problem : Discuss in Forum |
| 8. | Which of the following statements are correct about the program below? | ||||||||||||||||
Answer: Option B Explanation: This program converts the given string to upper case string. Output: Enter a string: indiabix INDIABIX Learn more problems on : Strings Discuss about this problem : Discuss in Forum |
| 9. | What will be the output of the program ? | ||||||||||||||||
Answer: Option A Learn more problems on : Structures, Unions, Enums Discuss about this problem : Discuss in Forum |
| 10. | If the file 'source.txt' contains a line "Be my friend" which of the following will be the output of below program? | ||||||||||||||||
Answer: Option C Explanation: The file source.txt contains "Be my friend". fseek(fs, 0, SEEK_END); moves the file pointer to the end of the file. fseek(fs, -3L, SEEK_CUR); moves the file pointer backward by 3 characters. fgets(c, 5, fs); read the file from the current position of the file pointer. Hence, it contains the last 3 characters of "Be my friend". Therefore, it prints "end". Learn more problems on : Input / Output Discuss about this problem : Discuss in Forum |
| 11. | Point out the error in the program? | ||||||||||||||||
Answer: Option B Explanation: Instead of 20 use 20L since fseek() need a long offset value.Learn more problems on : Input / Output Discuss about this problem : Discuss in Forum |
| 12. | What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> myprog one two three | ||||||||||||||||
Answer: Option B Learn more problems on : Command Line Arguments Discuss about this problem : Discuss in Forum |
| 13. | What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample 1 2 3 | ||||||||||||||||
Answer: Option C Learn more problems on : Command Line Arguments Discuss about this problem : Discuss in Forum |
| 14. | What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample friday tuesday sunday | ||||||||||||||||
Answer: Option C Learn more problems on : Command Line Arguments Discuss about this problem : Discuss in Forum |
| 15. | Which of the following statements are correct about the program? | ||||||||||||||||
Answer: Option A Learn more problems on : Bitwise Operators Discuss about this problem : Discuss in Forum |
| 16. | Point out the error in the program. | ||||||||||||||||
Answer: Option A Explanation: Step 1: char mybuf[] = "India"; The variable mybuff is declared as an array of characters and initialized with string "India". Step 2: char yourbuf[] = "BIX"; The variable yourbuf is declared as an array of characters and initialized with string "BIX". Step 3: char const *ptr = mybuf; Here, ptr is a constant pointer, which points at achar. The value at which ptr it points is a constant; it will be an error to modify the pointed character; There will not be any error to modify the pointer itself. Step 4: *ptr = 'a'; Here, we are changing the value of ptr, this will result in the error "cannot modify a const object". Learn more problems on : Const Discuss about this problem : Discuss in Forum |
| 17. | Declare the following statement? "An array of three pointers to chars". | ||||||||||||||||
Answer: Option B Learn more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum |
| 18. | What do the following declaration signify? | ||||||||||||||||
Answer: Option B Learn more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum |
| 19. | What will be the output of the program? | ||||||||||||||||
Answer: Option C Learn more problems on : Complicated Declarations Discuss about this problem : Discuss in Forum |
| 20. | Can you use the fprintf() to display the output on the screen? | ||||||||
Answer: Option A Explanation: Do like this fprintf(stdout, "%s %d %f", str, i, a);Learn more problems on : Library Functions |


No comments:
Post a Comment