P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

Similar documents
2. C99 standard guarantees uniqueness of characters for internal names. A. 12 B. 26 C. 31 D. 48

Fundamentals of Programming

EL6483: Brief Overview of C Programming Language

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

MISRA-C:2012 Standards Model Summary for C / C++

Fundamental of Programming (C)

Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Princeton University COS 333: Advanced Programming Techniques A Subset of C90



B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

Lecture 02 C FUNDAMENTALS

A Fast Review of C Essentials Part I

Motor Industry Software Reliability Association (MISRA) C:2012 Standard Mapping of MISRA C:2012 items to Goanna checks

Tokens, Expressions and Control Structures

Introduction to C Language (M3-R )

C Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS

C: How to Program. Week /Mar/05

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Short Notes of CS201

CODE TIME TECHNOLOGIES. Abassi RTOS MISRA-C:2004. Compliance Report

Review of the C Programming Language

Programming in C and C++

CS201 - Introduction to Programming Glossary By

BLM2031 Structured Programming. Zeyneb KURT

CS313D: ADVANCED PROGRAMMING LANGUAGE

Chapter 2 - Introduction to C Programming

Review of the C Programming Language for Principles of Operating Systems

M1-R4: Programing and Problem Solving using C (JAN 2019)

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

INTRODUCTION 1 AND REVIEW

Chapter 1 & 2 Introduction to C Language

Lecture 2: C Programming Basic

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

CSCI 171 Chapter Outlines

CSC 1214: Object-Oriented Programming

Work relative to other classes

Axivion Bauhaus Suite Technical Factsheet MISRA

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants

XSEDE Scholars Program Introduction to C Programming. John Lockman III June 7 th, 2012

Model Viva Questions for Programming in C lab

CMPE-013/L. Introduction to C Programming

Data types, variables, constants

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and

Practical C++ Programming

Presented By : Gaurav Juneja

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

C Language, Token, Keywords, Constant, variable

Flow Control. CSC215 Lecture

Programming in C and C++

QUIZ. What are 3 differences between C and C++ const variables?

Basic Types, Variables, Literals, Constants

COMP322 - Introduction to C++

Class B.Com. III Sem.

C - Basics, Bitwise Operator. Zhaoguo Wang

Fundamental of C programming. - Ompal Singh

CS 61C: Great Ideas in Computer Architecture. Lecture 2: Numbers & C Language. Krste Asanović & Randy Katz

C-LANGUAGE CURRICULAM

6.096 Introduction to C++ January (IAP) 2009

Agenda. CS 61C: Great Ideas in Computer Architecture. Lecture 2: Numbers & C Language 8/29/17. Recap: Binary Number Conversion

The component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science

Decision Making -Branching. Class Incharge: S. Sasirekha

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Topic 6: A Quick Intro To C

Structure of this course. C and C++ Past Exam Questions. Text books

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

Topic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History

BASIC ELEMENTS OF A COMPUTER PROGRAM

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

CSI33 Data Structures

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions.

Computers Programming Course 5. Iulian Năstac

PROGRAMMAZIONE I A.A. 2017/2018

#include. Practical C Issues: #define. #define Macros. Example. #if

Procedures, Parameters, Values and Variables. Steven R. Bagley

Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

SOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE

CS Programming In C

Axivion Bauhaus Suite Technical Factsheet AUTOSAR

A S H O R T I S H O V E R V I E W O F T H E A N S I C P R O G R A M M I N G L A N G U A G E

C Programming Multiple. Choice

Programming. C++ Basics

INDEX. Figure I-0. Listing I-0. Table I-0. Symbols.DIRECTIVE (see Assembler directives)? preprocessor operator 3-34

ET156 Introduction to C Programming

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

(heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford. 1. Types Variables Expressions & Statements 2/23

edunepal_info

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam

Motivation was to facilitate development of systems software, especially OS development.

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

Transcription:

P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above TEST - CS-005 2017-2018 2. Variable names beginning with underscore is not encouraged. Why? a) It is not standardized b) To avoid conflicts since assemblers and loaders use such names c) To avoid conflicts since library routines use such names d) To avoid conflicts with environment variables of an operating system 3. Which of the following cannot be a variable name in C? a) volatile b) true c) friend d) export 4. What is short int in C programming? a) Basic data type of C b) Qualifier c) short is the qualifier and int is the basic datatype d) All of the mentioned 5. Which type conversion is NOT accepted? a) From char to int b) From float to char pointer c) From negative int to char d) From double to char

6. Integer division results in a) truncation b) rounding c) overflow d) none of the above 7. Which of the data types have size that is variable? a) int b) struct c) float d) double 8. enum types are processed by a) Compiler b) Preprocessor c) Linker d) Assembler 9. Which is false? a) Constant variables need not be defined as they are declared and can be defined later b) Global constant variables are initialized to zero c) const keyword is used to define constant values d) You cannot reassign a value to a constant variable 10. The precedence of arithmetic operators is (from highest to lowest) a) %, *, /, +, b) %, +, /, *, c) +, -, %, *, / d) %, +, -, *, /

11. Does logical operators in C language are evaluated with short circuit? a) True b) False c) Depends on the compiler d) Depends on the standard 12. Which of the following typecasting is accepted by C? a) Widening conversions b) Narrowing conversions c) Both d) None of the mentioned 13. Operation a = a * b + a can also be written as: a) a *= b + 1; b) (c = a * b)!=(a = c + a); c) a = (b + 1)* a; d) All of the mentioned 14. Which of the following is a ternary operator? a) && b) >>= c)?: d) -> 15.Switch statement accepts. a) int b) char c) long d) All of the mentioned 16. The following code for(;;) represents an infinite loop. It can be terminated by. a) break b) exit(0) c) abort() d) All of the mentioned

17. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)? a) Variable b) Function c) typedef d) macros 18.What is the value of x in this C code? 1. #include <stdio.h> 2. void main() 3. { 4. int x = 5 * 9 / 3 + 9; 5. } a) 3.75 b) Depends on compiler c) 24 d) 3 19. When double is converted to float, the value is? a) Truncated b) Rounded c) Depends on the compiler d) Depends on the standard 20. What is the output of this C code? 1. #include <stdio.h> 2. void main() 3. { 4. int i = 0; 5. while (++i) 6. { 7. printf("h"); 8. } 9. } a) H b) H is printed infinite times c) Compile time error d) Varies

21. Example of iteration in C. a) for b) while c) do-while d) All of the mentioned 22. Which keyword can be used for coming out of recursion? a) break b) return c) exit d) Both (a) and (b) 23. The value obtained in the function is given back to main by using keyword? a) return b) static c) new d) volatile 24. What is the output of this C code? 1. #include <stdio.h> 2. int main() 3. { 4. int y = 2; 5. int z = y +(y = 10); 6. printf("%d\n", z); 7. } a) 12 b) 20 c) 4 d) Either 12 or 20

25. What is the output of code given below? 1. #include <stdio.h> 2. int main() 3. { 4. printf("%d ", 1); 5. l1:l2: 6. printf("%d ", 2); 7. printf("%d\n", 3); 8. } a) Compilation error b) 123 c) 12 d) 13 26. goto can be used to jump from main to within a function a) true b) false c) Depends d) Varies 27. Property of external variable to be accessed by any source file is called by C90 standard as a) external linkage b) external scope c) global scope d) global linkage 28. What is the scope of an external variable? a) Whole source file in which it is defined b) From the point of declaration to the end of the file in which it is defined c) Any source file in a program d) From the point of declaration to the end of the file being compiled

29. Which of the following cannot be static in C? a) Variables b) Functions c) Structures d) None of the mentioned 30.Property which allows to produce different executable for different platforms in C is called? a) File inclusion b) Selective inclusion c) Conditional compilation d) Recursive macros 31. C preprocessors can have compiler specific features. a) true b) false c) Depends on the standard d) Depends on the platform 32. Preprocessor feature that supply line numbers and filenames to compiler is called? a) Selective inclusion b) macro substitution c) Concatenation d) Line control 33. Which of the following are C preprocessors? a) #ifdef b) #define c) #endif d) All of the mentioned 34. The C-preprocessors are specified with symbol. a) # b) $ c) d) None of the mentioned

35. Automatic variables are variables that are a) Declared within the scope of a block, usually a function b) Declared outside all functions c) Declared with auto keyword d) Declared within the keyword extern 36. Which of the following storage class supports char data type? a) register b) static c) auto d) All of the mentioned 37. function tolower(c) defined in library works for a) Ascii character set b) Unicode character set c) Ascii and utf-8 but not EBSIDIC character set d) Any character set 38. What is the output of this C code? 1. #include <stdio.h> 2. int main() 3. { 4. int a = 2; 5. if (a >> 1) 6. printf("%d\n", a); 7. } a) 0 b) 1 c) 2 d) No Output.

39. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)? a) Variable b) Function c) typedef d) macros 40. Which keyword can be used for coming out of recursion? a) break b) return c) exit d) Both (a) and (b) 41. The scope of an automatic variable is: a) Within the block it appears b) Within the blocks of the block it appears c) Until the end of program d) Both (a) and (b) 42.What linkage does automatic variables have? a) Internal linkage b) External linkage c) No linkage d) None of the mentioned 43. What is the output of this C code? 1. #include <stdio.h> 2. void main() 3. { 4. int x; } here x is a) automatic variable b) static variable c) register variable d) global variable. 44. #include <somefile.h> are files and #include somefile.h files. a) Library, Library b) Library, user-created header c) User-created header, library d) They can include all types of file

45. Can function definition be present in header files? a) Yes b) No c) Depends on the compiler d) Depends on the standard 46. Which of the following file extensions are accepted with #include? a).h b).in c).com d) All of the mentioned 47. For each #if,#ifdef, and #ifndef directive. a) There are zero or more #elif directives b) Zero or one #else directive c) One matching #endif directive d) All of the mentioned 48. For each #if,#ifdef, and #ifndef directive. a) There are zero or more #elif directives b) Zero or one #else directive c) One matching #endif directive d) All of the mentioned 49. Which is an indirection operator among the following? a) & b) * c) -> d). 50. Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0;? a) int *ptr = &a; b) int *ptr = &a &a; c) int *ptr = a a; d) All of the mentioned Answer Key:

1. a)systems programming language 2. c) To avoid conflicts since library routines use such names 3. a) volatile 4. c) short is the qualifier and int is the basic datatype 5. b) From float to char pointer 6. a) truncation 7. b) struct 8. a) Compiler 9. a) Constant variables need not be defined as they are declared and can be defined later 10. a) %,*,/, +, 11. a) True 12. c) Both 13. d) All of the mentioned 14. c)?: 15. d) All of the mentioned 16. a) break 17. d) macros 18. c) 24 19. c) Depends on the compiler 20. b) H is printed infinite times 21. d) All of the mentioned 22. b) return 23. a) return 24. b) 20 25. b) 123 26. b) false 27. a) external linkage 28. d) From the point of declaration to the end of the file being compiled 29. d) None of the mentioned 30. c) Conditional compilation 31. a) true 32. d) Line control 33. d) All of the mentioned 34. a) # 35. a) Declared within the scope of a block, usually a function

36. d) All of the mentioned 37. d) Any character set 38. c) 2 39. d) macros 40. b) return 41. d) Both (a) and (b) 42. c) No linkage 43. a) automatic variable 44. d) They can include all types of file 45. a) Yes 46. d) All of the mentioned 47. d) All of the mentioned 48. b) Zero or one #else directive 49. b) * 50. a) int *ptr = &a;