Test Paper 1.txt

  • Uploaded by: mmj
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Test Paper 1.txt as PDF for free.

More details

  • Words: 798
  • Pages: 4
1. What is the output of this C code? #include

<stdio.h>

int main() { char chr; chr = 128; printf(�%d\n�, chr); return 0; } o A ) 128 o B ) -128 o C ) Depends on the compiler o D ) None of the mentioned 2. What is the output of this C code? #include <stdio.h> int main() { float x = �a�; printf(�%f�, x); return 0; } o A ) a o B ) run time error o C ) a.0000000 o D ) 97.000000 3. All keywords in C are in o A ) LowerCase letters o B ) UpperCase letters o C ) CamelCase letters o D ) None 4. Variable name resolving (number of significant characters for uniqueness of variable) depends on o A ) Compiler and linker implementations o B ) Assemblers and loaders implementations o C ) C language o D ) None 5. Which is valid C expression? o A ) int my_num = 100,000; o B ) int my_num = 100000; o C ) int my num = 1000;

o D ) int $my_num = 10000; 6. Which of the following is not a valid variable name declaration? o A ) float PI = 3.14; o B ) double PI = 3.14; o C ) int PI = 3.14; o D ) #define PI 3.14; 7. Which data type is most suitable for storing a number 65000 in a 32-bit system? o A ) short o B ) int o C ) long o D ) double 8. Comment on the output of this C code? #include <stdio.h> int main() { float f1 = 0.1; if (f1 == 0.1) printf(�equal\n�); else printf(�not equal\n�); } o A ) equal o B ) not equal o C ) Output depends on compiler o D ) None of the mentioned 9. Which of the following is true for variable names in C? o A ) They can contain alphanumeric characters as well as special characters o B ) It is not an error to declare a variable to be one of the keywords(like goto, static) o C ) Variable names cannot start with a digit o D ) Variable can be of any length 10. What will happen if the below program is executed? #include <stdio.h> int main() { int main = 3; printf(�%d�, main); return 0; }

o A ) It will cause a compile-time error o B ) It will cause a run-time error o C ) It will run without any error and prints 3 o D ) It will experience infinite looping 11. Which of the following is not a valid C variable name? o A ) int variable_count o B ) int number o C ) float rate o D ) int $main 12. The format identifier �%i� is also used for _____ data type? o A ) char o B ) int o C ) float o D ) double 13. Consider on following declaration: (i)

short i=10;

(ii)

static i=10;

(iii) unsigned i=10; (iv) const i=10; o A ) Only (iv) is incorrect o B ) Only (ii) and (iv) are incorrect o C ) Only (ii),(iii) and (iv) are correct o D ) All are correct declaration 14. What is the output of this C code? #include <stdio.h> int main() { printf(�Hello World! %d \n�, x); return 0; } o o o o

A B C D

) ) ) )

Hello World! x; Hello World! followed by a junk value Compile time error Hello World!

15. What is the output of this C code? #include <stdio.h> int main() { int y = 10000;

int y = 34; printf(�Hello World! %d\n�, y); return 0; } o o o o 16. Which is

A B C D

) ) ) )

Compile time Hello World! Hello World! Hello World!

error 34 1000 followed by a junk value

correct with respect to size of the datatypes? A ) char > int > float B ) int > char > float C ) char < int < double D ) double > char > int

17. What is the size of an int data type? A ) 4 Bytes B ) 8 Bytes C ) Depends on the system/compiler D ) Cannot be determined 18. Literal means ? A ) a string. B ) a string constant. C ) a character. D ) an alphabet. 19. Which of the following cannot be a variable name in C? A ) Volatile B ) true C ) friend D ) export 20. Which of the following is a User-defined data type? A ) typedef int Boolean; B ) typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays; C ) struct {char name[10], int age}; D ) all of the mentioned

Related Documents

Test Paper
May 2020 11
Test Paper
November 2019 12
Test Paper
June 2020 13
Test Paper
May 2020 6
Vedanta Test Paper
May 2020 1
Infosys Test Paper 6
October 2019 25

More Documents from "pahal"