# z = x + y * z / 4 % 2-1

Save this PDF as:

Size: px
Start display at page:

Download "z = x + y * z / 4 % 2-1"

## Transcription

1 1.Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1? A. rem = 3.14 % 2.1; B. rem = modf(3.14, 2.1); C. rem = fmod(3.14, 2.1); D. Remainder cannot be obtain in floating point division. 2. Which of the following special symbol allowed in a variable name? A. * (asterisk) B. (pipeline) C. - (hyphen) D. _ (underscore) 3. Which of the following is not logical operator? A. & B. && C. D.! 4. Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2-1 A. * / % + - = B. = * / % + - C. / * % - + = D. * % / - + = 5. Which of the following correctly shows the hierarchy of arithmetic operations in C? A. / + * - B. * - / + C. + - / * D. / * Which of the following is the correct usage of conditional operators used in C? A. a>b? c=30 : c=40; B. a>b? c=30;

2 C. max = a>b? a>c?a:c:b>c?b:c D. return (a>b)?(a:b) 7. What are the different types of real data type in C? A. float, double B. short int, double, long int C. float, double, long double D. double, long int, float 8. What will you do to treat the constant 3.14 as a long double? A. use 3.14LD B. use 3.14L C. use 3.14DL D. use 3.14LF 9. What will you do to treat the constant 3.14 as a long double? A. use 3.14LD B. use 3.14L C. use 3.14DL D. use 3.14LF 10.The keyword used to transfer control from a function back to the calling function is A. switch B. goto C. go back D. return 11. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array? A. The element will be set to 0. B. The compiler would report an error. C. The program may crash if some important data gets overwritten. D. The array size would appropriately grow. 12.In C, if you pass an array as an argument to a function, what actually gets passed? A. Value of elements in array

3 B. First element of the array C. Base address of the array D. Address of the last element of array 13 Which of the following function sets first n characters of a string to a given character? A. strinit() B. strnset() C. strset() D. strcset() 14. If the two strings are identical, then strcmp() function returns A. -1 B. 1 C. 0 D. Yes 15.Which of the following function is used to find the first occurrence of a given string in another string? A. strchr() B. strrchr() C. strstr() D. strnset() 16.Which of the following function is more appropriate for reading in a multi-word string? A. printf(); B. scanf(); C. gets(); D. puts(); 17.To print out a and b given below, which of the following printf() statement will you use?

4 float a=3.14; double b=3.14; A. printf("%f %lf", a, b); B. printf("%lf %f", a, b); C. printf("%lf %Lf", a, b); D. printf("%f %Lf", a, b); 18.In which numbering system can the binary number be easily converted to? A. Decimal system B. Hexadecimal system C. Octal system D. No need to convert 19.Which bitwise operator is suitable for turning off a particular bit in a number? A. && operator B. & operator C. operator D.! operator 20.Which bitwise operator is suitable for checking whether a particular bit is on or off? A. && operator B. & operator C. operator D.! operator

5 21.How many times "Welcome" is get printed? int x; for(x=-1; x<=10; x++) if(x < 5) continue; else break; printf("welcome"); A. Infinite times B. 11 times C. 0 times D. 10 times 22.How many times the while loop will get executed if a short int is 2 byte wide? int j=1; while(j <= 255) printf("%c %d\n", j, j); j++; A. Infinite times B. 255 times C. 256 times D. 254 times 23.In mathematics and computer programming, which is the correct order of mathematical operators? A. Addition, Subtraction, Multiplication, Division B. Division, Multiplication, Addition, Subtraction C. Multiplication, Addition, Division, Subtraction

6 D. Addition, Division, Modulus, Subtraction 24.Which of the following cannot be checked in a switch-case statement? A. Character B. Integer C. Float D. enum 25.Which of the following function is correct that finds the length of a string? A. int xstrlen(char *s) int length=0; while(*s!='\0') length++; s++; return (length); B. int xstrlen(char s) int length=0; while(*s!='\0') length++; s++; return (length); C. int xstrlen(char *s) int length=0; while(*s!='\0') length++; return (length); D. int xstrlen(char *s) int length=0; while(*s!='\0') s++; return (length); 26.When we mention the prototype of a function? A. Defining B. Declaring C. Prototyping D. Calling 27.By default a real number is treated as a A. float B. double C. long double D. far double

7 28.Identify which of the following are declarations 1 : extern int x; 2 : float square ( float x )... 3 : double pow(double, double); A. 1 B. 2 C. 1 and 3 D Which of the following cannot be checked in a switch-case statement? A. Character B. Integer C. Float D. enum 30.A function cannot be defined inside another function A. True B. False 31.Which of the following statements are correct about the program? printf("%p\n", main()); A. It prints garbage values infinitely B. Runs infinitely without printing anything C. Error: main() cannot be called inside printf() D. No Error and print nothing

8 32. Which of the following statements are correct about the function? long fun(int num) int i; long f=1; for(i=1; i<=num; i++) f = f * i; return f; A. The function calculates the value of 1 raised to power num. B. The function calculates the square root of an integer C. The function calculates the factorial value of an integer D. None of above 33. What will be the output of the program in 16 bit platform (Turbo C under DOS)? int fun(); int i; i = fun(); printf("%d\n", i); int fun() _AX = 1990; A. Garbage value B. 0 (Zero) C D. No output

9 34. Will the program compile successfully? char a[] = "India"; char *p = "BIX"; a = "BIX"; p = "India"; printf("%s %s\n", a, p); A. Yes B. No 35.What will be the output of the program? #include<string.h> char str1[20] = "Hello", str2[20] = " World"; printf("%s\n", strcpy(str2, strcat(str1, str2))); A. Hello B. World C. Hello World D. WorldHello 36. What will be the output of the program? char p[] = "%d\n"; p[1] = 'c'; printf(p, 65); A. A B. a C. c D. 65

10 37. What will be the output of the program? #include<string.h> printf("%d\n", strlen("123456")); A. 6 B. 12 C. 7 D What will be the output of the program? printf(5+"good Morning\n"); A. Good Morning B. Good C. M D. Morning 39.If the size of pointer is 4 bytes then What will be the output of the program? char *str[] = "Frogs", "Do", "Not", "Die", "They", "Croak!"; printf("%d, %d", sizeof(str), strlen(str[0])); A. 22, 4 B. 25, 5 C. 24, 5 D. 20, 2

11 40. Which of the following statements are correct? 1: A string is a collection of characters terminated by '\0'. 2: The format specifier %s is used to print a string. 3: The length of the string can be obtained by strlen(). 4: The pointer CANNOT work on string. A. 1, 2 B. 1, 2, 3 C. 2, 4 D. 3, Which of the following statement is correct? A. strcmp(s1, s2) returns a number less than 0 if s1>s2 B. strcmp(s1, s2) returns a number greater than 0 if s1<s2 C. strcmp(s1, s2) returns 0 if s1==s2 D. strcmp(s1, s2) returns 1 if s1==s2 42. What will be the output of the program? int i=-3, j=2, k=0, m; m = ++i && ++j && ++k; printf("%d, %d, %d, %d\n", i, j, k, m); A. -2, 3, 1, 1 B. 2, 3, 1, 2 C. 1, 2, 3, 1 D. 3, 3, 1, 2

12 43. Assunming, integer is 2 byte, What will be the output of the program? printf("%x\n", -2<<2); A. ffff B. 0 C. fff8 D. Error 44. What will be the output of the program? int x=12, y=7, z; z = x!=4 y == 2; printf("z=%d\n", z); A. z=0 B. z=1 C. z=4 D. z=2 45. The expression of the right hand side of operators doesn't get evaluated if the left hand side determines the outcome. A. True B. False 46.In the expression a=b=5 the order of Assignment is NOT decided by Associativity of operators A. True B. False 47.Associativity of an operator is either Left to Right or Right to Left. A. True B. False

13 48. Are the following two statement same? 1. a <= 20? (b = 30): (c = 30); 2. (a <=20)? b : (c = 30); A. Yes B. No 49. What will be the output of the program? int i=0; for(; i<=5; i++); printf("%d", i); A. 0, 1, 2, 3, 4, 5 B. 5 C. 1, 2, 3, 4 D What will be the output of the program? char str[]="c-program"; int a = 5; printf(a >10?"Ps\n":"%s\n", str); A. C-program B. Ps C. Error D. None of above

14 51.Point out the error, if any in the for loop. int i=1; for(;;) printf("%d\n", i++); if(i>10) break; A. There should be a condition in the for loop B. The two semicolons should be dropped C. The for loop should be replaced with while loop. D. No error 52. Point out the error, if any in the program. int a = 10; switch(a) printf("this is c program."); A. Error: No case statement specified B. Error: No default specified C. No Error D. Error: infinite loop occurs

15 53. A short integer is at least 16 bits wide and a long integer is at least 32 bits wide. A. True B. False 54. If scanf() is used to store a value in a char variable then along with the value a carriage return(\r) also gets stored it. A. True B. False 55. The modulus operator cannot be used with a long double. A. True B. False 56. The way the break is used to take control out of switch and continue to take control of the beginning of the switch? A. Yes B. No 57.We want to test whether a value lies in the range 2 to 4 or 5 to 7. Can we do this using aswitch? A. Yes B. No 58. By default, the data type of a constant without a decimal point is int, whereas the one with a decimal point is a double. A. Yes B. No 59. The way the break is used to take control out of switch and continue to take control of the beginning of the switch? A. Yes B. No 60.Can we use a switch statement to switch on strings? A. Yes B. No

### MGM s JNEC Question Bank Subject: Computer Engineering

MGM s JNEC Question Bank Subject: Computer Engineering 1. All of the following are examples of computer input units EXCEPT: a) Scanner b) Speaker c) Bar code reader d) Keyboard Answer: b 2. Which of the

### BSc (Hons) Computer Science with Network Security, BSc (Hons) Business Information Systems, BSc (Hons) Mathematics & BSc (Hons) Software Engineering

BSc (Hons) Computer Science with Network Security, BSc (Hons) Business Information Systems, BSc (Hons) Mathematics & BSc (Hons) Software Engineering Cohort: BCNS/07/FT- BIS/07/FT- BIS/06/FT -BM/07/FT BSE/07/FT/PT-

### MIT Aurangabad FE Computer Engineering

MIT Aurangabad FE Computer Engineering Unit 1: Introduction to C 1. The symbol # is called a. Header file c. include b. Preprocessor d. semicolon 2. The size of integer number is limited to a. -32768 to

### Punctuation in C. Identifiers and Expressions. Identifiers. Variables. Keywords. Identifier Examples

Identifiers and Expressions CSE 130: Introduction to C Programming Spring 2005 Punctuation in C Statements are terminated with a ; Groups of statements are enclosed by curly braces: { and } Commas separate

### M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: IMPORTANT INSTRUCTIONS: 1. Question Paper in English and Hindi and Candidate can choose any one language. 2. In case of discrepancies in

### C AND C++ PROGRAMMING

C AND C++ PROGRAMMING Bharathidasan University A Courseware prepared by University Informatics Centre Part I - Programming in C Getting Started This courseware is intended to be an introduction to C programming

### Dept. of CSE, IIT KGP

Programming in C: Basics CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of variable We must declare the

### C Programming Laboratory

Sheet 1 of 14 LAB 1: Introduction to C Environment Objective: In this laboratory session you will learn: 1. How to create C programs 2. How C programs are organised 3. How to write a basic program to display

### C Programming Dr. Hasan Demirel

C How to Program, H. M. Deitel and P. J. Deitel, Prentice Hall, 5 th edition (3 rd edition or above is also OK). Introduction to C Programming Dr. Hasan Demirel Programming Languages There are three types

### UNIT-1. C Programming & Data Structures. Introduction to Computers: Computing Environment: Types of Computing Environments:

Introduction to Computers: C Programming & Data Structures UNIT-1 A computer system consists of hardware and software. Computer hardware is the collection of physical elements that comprise a computer

### Common Errors in C. David Chisnall. February 15, 2011

Common Errors in C David Chisnall February 15, 2011 The C Preprocessor Runs before parsing Allows some metaprogramming Preprocessor Macros Are Not Functions The preprocessor performs token substitution

### C Programming, Chapter 1: C vs. Java, Types, Reading and Writing

C Programming, Chapter 1: C vs. Java, Types, Reading and Writing T. Karvi August 2013 T. Karvi C Programming, Chapter 1: C vs. Java, Types, Reading and Writing August 2013 1 / 1 C and Java I Although the

### SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR ODD/EVEN ACADEMICSEMESTER (2014-15) ASSIGNMENT / QUESTION BANK (2110003) [F.Y.B.E.

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR ODD/EVEN ACADEMICSEMESTER (2014-15) ASSIGNMENT / QUESTION BANK Subject: Computer Programming and Utilization (2110003) [F.Y.B.E.: ALL BRANCHES] Unit 1

### Reading Assignment. Main Program in C. K.N. King Chapter 2. K.N. King Chapter 3. K.N. King Chapter 4. K.N. King Chapter 7. Our first C program

Reading Assignment Main Program in C In C the main program is a function called main The body of the function is enclosed in left ( ) and right ( ) curly braces. K.N. King Chapter 2 K.N. King Chapter 3

### The if-statement. Simple and compound statements. The if-statement comes in two forms: Simple statements:

1 2 Simple and compound s The if- Simple s: E.g.: expression; Various jumps : break, goto, continue, return. k = a * p + 3; printf("k = %d\n", k); 1 + 2; ; The if- comes in two forms: or E.g.: if (expression)

### Programming Language: Syntax. Introduction to C Language Overview, variables, Operators, Statements

Programming Language: Syntax Introduction to C Language Overview, variables, Operators, Statements Based on slides McGraw-Hill Additional material 2004/2005 Lewis/Martin Modified by Diana Palsetia Syntax

### FORMAT MEANING VARIABLE TYPE

Printf and Scanf Both formatted I/O Both sent to standard I/O location Printf Converts values to character form according to the format string Scanf Converts characters according to the format string,

### Going from Python to C

Going from Python to C Darin Brezeale December 8, 2011 Python is a high-level, interpreted language. C has many of the same types of programming constructs as in Python: arrays, loops, conditionals, functions,

### 6.096 Lab 1. Due: 7 January 12:30:00. September 20, 2011

6.096 Lab 1 Due: 7 January 1:30:00 September 0, 011 1 Additional Material 1.1 Constants A constant is an expressions with a fixed value. Kinds of constants: Literals: used to express particular values

### ROUND 2 (2 ND YEAR) a) Yes b) No c) Depends on the compiler d) Depends on the standard

ROUND 2 (2 ND YEAR) 1) Find the output? 2. void 3. 4. int x = 1, z = 3; 5. int y = x

### Branching. We ll continue to look at the basics of writing C++ programs including. Overview

Branching Overview We ll continue to look at the basics of writing C++ programs including Boolean Expressions (need to know this before we can using branching and looping!) Branching J.S. Bradbury CSCI

### Sources: On the Web: Slides will be available on:

C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

### Introduction to C Programming

Introduction to C Programming C HOW TO PROGRAM, 6/E 1992-2010 by Pearson Education, Inc. All Rights Reserved. 2.1 Introduction The C language facilitates a structured and disciplined approach to computer

### Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

### A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

### STRINGS. If you follow the rule of array initialization then you can write the above statement as follows:

STRINGS The string in C programming language is actually a one-dimensional array of characters which is terminated by a null character '\0'. Thus a null-terminated string contains the characters that comprise

### Introduction to C++ Programming

Introduction to C++ Programming 1 Outline Introduction to C++ Programming A Simple Program: Printing a Line of Text Another Simple Program: Adding Two Integers Memory Concepts Arithmetic Decision Making:

### Tutorial No. 8 - Solution (Strings and User Defined Functions)

Tutorial No. 8 - Solution (Strings and User Defined Functions) 1. Explain strcat( ), strcpy( ),strncmp( ) and strstr( ) string manipulation function. [6] strcat() Function: The strcat function joins two

### 1. Constants. 2. Variables. 3. Reserved words or key words. 4. Constants. Character set in C

Character set in C We should use only the following characters in writing a C program. These characters can be combined to create C words. Alphabet: A, B, C, D.. Z, a, b, c, d..z Numeric digits: 0, 1,

### Introduction to C Programming S Y STEMS

Introduction to C Programming CS 40: INTRODUCTION TO U NIX A ND L I NUX O P E R AT ING S Y STEMS Objectives Introduce C programming, including what it is and what it contains, which includes: Command line

### Programming for MSc Part I

Herbert Martin Dietze University of Buckingham herbert@the-little-red-haired-girl.org July 24, 2001 Abstract The course introduces the C programming language and fundamental software development techniques.

### INTI COLLEGE MALAYSIA

CSC112 (F) / Page 1 of 5 INTI COLLEGE MALAYSIA CERTIFICATE IN COMPUTING AND INFORMATION TECHNOLOGY PROGRAMME CSC 112 : FUNDAMENTALS OF PROGRAMMING FINAL EXAMINATION : DECEMBER 2002 SESSION This paper consists

### C Primer. Fall Introduction C vs. Java... 1

CS 33 Intro Computer Systems Doeppner C Primer Fall 2016 Contents 1 Introduction 1 1.1 C vs. Java.......................................... 1 2 Functions 1 2.1 The main() Function....................................

### Characters and Strings. Constants

Characters and Strings Constants Characters are the fundamental building blocks of source programs Character constants One character surrounded by single quotes A or? Actually an int value represented

### Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

### Overview of a C Program

Overview of a C Program Programming with C CSCI 112, Spring 2015 Patrick Donnelly Montana State University Programming with C (CSCI 112) Spring 2015 2 / 42 C Language Components Preprocessor Directives

### Arrays and Pointers (part 1)

Arrays and Pointers (part 1) EECS 2031 25 September 2016 1 Arrays l Grouping of data of the same type. l Loops commonly used for manipulation. l Programmers set array sizes explicitly. 2 1 Arrays: Example

### Use the function below for problem #2 Use the function below for problem #3

1. Which of the following is TRUE regarding arrays? [A]The name of the array represents the first value in the array. [B] The name of the array represents all values found in the array. [C] The name of

### Basic Common Unix commands: Change to directory d

Basic Common Unix commands: cd d Change to directory d mkdir d rmdir d mv f1 [f2...] d mv d1 d2 ls [d] [f...] ls -1 [f...] vi [f] emacs [f] more f cp f1 f2 mv f1 f2 rm f gcc [-o f1] f2 gnuplot Create new

### Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

### Introduction to Computers and Programming

16.070 Introduction to Computers and Programming March 14 Recitation 6 Spring 2002 Topics: Quick review of PS4 issues Fundamental Data types ASCII / Arithmetic Conversion Number Systems / Logical Operation

### 7 Introduction to C++

7 Introduction to C++ 7.1 Introduction C++ is an extension to C Programming language. It was developed at AT&T Bell Laboratories in the early 1980s by Bjarne Stroustrup. It is a deviation from traditional

### Reading. C Programming Language. Basic syntax Whitespaces. Whitespaces (cont d) #include. Basic syntax Comments

Reading C Programming Language Types, operators, expressions Control flow, functions Basic IO K&R Chapter 2 Types, Operators, and Expressions K&R Chapter 3 Control Flow K&R Chapter 7 Basic I/O NEWS Assignment

### Pseudocode. Pseudocode. Guide for Pseudocode. Computers in Engineering Pseudocode and C Language Review. Example Pseudocode.

Computers in Engineering Pseudocode and C Language Review Pseudocode Pseudocode is an artificial and informal language that helps you develop algorithms Pseudocode is similar to everyday English; it is

### INDEX. C programming Page 1 of 10. 5) Function. 1) Introduction to C Programming

INDEX 1) Introduction to C Programming a. What is C? b. Getting started with C 2) Data Types, Variables, Constants a. Constants, Variables and Keywords b. Types of Variables c. C Keyword d. Types of C

### Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

### Model Viva Questions for Programming in C lab

Model Viva Questions for Programming in C lab Common to: CSE 2 nd sem IT 2 nd sem Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart

### 3) Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

Freshers Club Important 100 C Interview Questions & Answers 1) How do you construct an increment statement or decrement statement in C? There are actually two ways you can do this. One is to use the increment

### CSI 333 Lecture 2 Introduction to C: Part I 2 1 / 16

CSI 333 Lecture 2 Introduction to C: Part I 2 1 / 16 Basics of C Remark: Skim Chapters 1 through 6 of Deitel & Deitel. You will notice the following: C is (more or less) a subset of Java. (So, you are

### Basic C Syntax. Comp-206 : Introduction to Software Systems Lecture 10. Alexandre Denault Computer Science McGill University Fall 2006

Basic C Syntax Comp-206 : Introduction to Software Systems Lecture 10 Alexandre Denault Computer Science McGill University Fall 2006 Next Week I'm away for the week. I'll still check my mails though. No

Standard C Input/Output 1 Output: printf() 2 Table of Contents Output: printf( ) - syntax & sematics Output: printf( ) - examples Output: printf( ) - format control Screen / Printer Control Input: scanf(

### Chapter 18 I/O in C. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter 18 I/O in C Standard C Library I/O commands are not included as part of the C language. Instead, they are part of the Standard C Library. A collection of functions and macros that must be implemented

### Chapter 2: Problem Solving Using C++

Chapter 2: Problem Solving Using C++ 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common

### Figure 1.12 Entering, Translating, and Running a High-Level Language Program Pearson Education, Inc. All rights reserved.

Figure 1.12 Entering, Translating, and Running a High-Level Language Program 1 2007 Pearson Education, Inc. All rights reserved. 2 Figure 2.7 General Form of a C Program 2007 Pearson Education, Inc. All

### FORM 1 (Please put your name, section # (10am- 001/2pm-002, and form # on the scantron!!!!) CS 161 Exam I:

FORM 1 (Please put your name, section # (10am- 001/2pm-002, and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. The following statement is legal: cout >> Hello, my name is

### Chapter 8. Arithmetic in C++

Christian Jacob Chapter 8 Arithmetic in C++ 8.1 The C++ Vocabulary 8.2 Variables and Types 8.2.1 Data Objects 8.2.2 Variables 8.2.3 Declaration of Variables 8.3 Elementary C++ Data Types 8.3.1 Integers

### C programming. Intro to syntax & basic operations

C programming Intro to syntax & basic operations Example 1: simple calculation with I/O Program, line by line Line 1: preprocessor directive; used to incorporate code from existing library not actually

### Fundamental Programming Structures in C

Fundamental Programming Structures in C M. Campbell 1993 Deakin University Aim Learning objectives Content After working through this module you should be able to create, compile and run a simple C program.

### 14 MAKING DECISIONS IN C

14 MAKING DECISIONS IN C 14.1 INTRODUCTION So far we have seen that in C programs the instructions are executed in the same order in which they appear in the program. Each instruction is executed once

### Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

### 198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored

### CMSC 106 Lecture Set #2. C language syntax. Syntax vs Semantics Examples

CMSC 106 Lecture Set #2 C Language Introduction C language syntax Syntax rules of the grammar vocabulary recognized by the language ANSI standard American National Standards Institute Semantics the meaning

### Introduction to Java

Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

### C for Java Programmers

C for Java Programmers CS 414 / CS 415 Niranjan Nagarajan Department of Computer Science Cornell University niranjan@cs.cornell.edu Original Slides: Alin Dobra Why use C instead of Java Intermediate-level

### 1. What is the output of this program?

1. What is the output of this program? char *ptr; char string[] = "How are you?"; ptr = string; ptr += 4; printf("%s",ptr); (a) How are you? (b) are you? (c) are (d) No output 2. Which of the following

### Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

### BHARATHIAR UNIVERSITY: COIMBATORE CENTRE FOR COLLABORATION OF INDUSTRY AND INSTITUTIONS(CCII) CERTIFICATE IN ADVANCED PROGRAMMING C++ LANGUAGE

Certificate in Advanced Programming - C++ Language Page 1 of 7 BHARATHIAR UNIVERSITY: COIMBATORE 641046 CENTRE FOR COLLABORATION OF INDUSTRY AND INSTITUTIONS(CCII) CERTIFICATE IN ADVANCED PROGRAMMING C++

### Arrays. Arrays, Argument Passing, Promotion, Demotion

Arrays Arrays, Argument Passing, Promotion, Demotion Review Introduction to C C History Compiling C Identifiers Variables Declaration, Definition, Initialization Variable Types Logical Operators Control

### 1. What does the following program print? #include <stdio.h> int main(void) { int a = 99; int b = 0; int c = 74;

1. What does the following program print? int a = 99; int b = 0; int c = 74; if( a b ) printf("first\n"); else printf("second\n"); if( a && c ) printf("third\n"); else printf("fourth\n"); if(!a ) printf("fifth\n");

### PE1 Worksheet. 3) What are the three control structures for writing an algorithm in pseudocode?

PE1 Worksheet Problem solving 1) What are the four stages of problem solving by programming? What shall be done in each stage? Stage 1: Stage 2: Stage 3: Stage 4: 2) What is the top-down design strategy

### Decimal and Binary Numbers By Dwight Watt, EdD Copyright 2000, 2014

Copyright 2000, 2014 As you work with the Internet and computers you will work with several number systems. Number systems give us a way to express numbers. There are an infinite number of number systems

### Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

Phys4051: C Lecture 2 & 3 Functions (Review) Comment Statements Variables & Operators Branching Instructions Comment Statements! Method 1: /* */! Method 2: // /* Single Line */ //Single Line /* This comment

### INTRODUCTION TO FLOWCHARTING

CHAPTER 1 INTRODUCTION TO FLOWCHARTING 1.0 Objectives 1.1 Introduction 1.2 Flowcharts 1.3 Types of Flowcharts 1.3.1 Types of flowchart 1.3.2 System flowcharts 1.4 Flowchart Symbols 1.5 Advantages of Flowcharts

### FBCA-02 April-2007 Programming in C Language BCA-102 (New Course)

Seat No. : FBCA-02 April-2007 Programming in C Language BCA-102 (New Course) Time : 3 Hours] [Max. Marks : 70 Instructions : (1) Figures to the right indicate full marks of the question. (2) Make and state

### Encoding Systems: Combining Bits to form Bytes

Encoding Systems: Combining Bits to form Bytes Alphanumeric characters are represented in computer storage by combining strings of bits to form unique bit configuration for each character, also called

### Chapter 6: Basic I/O. 6.1 printf

Chapter 6: Basic I/O So far, we've been using printf to do output, and we haven't had a way of doing any input. In this chapter, we'll learn a bit more about printf, and we'll begin learning about character-based

### ENGR 1000, Introduction to Engineering Design. Counting in Binary

ENGR 1000, Introduction to Engineering Design Unit 1: Prerequisite Knowledge for Mechatronics Systems Lesson 1.1: Converting binary numbers to decimal numbers and back Objectives: Convert decimal numbers

### ,!7IA3C1-dcahfj!:t;K;k;K;k. Addison-Wesley s JavaScript Reference Card. Kathleen M. Goelz and Carol J. Schwartz, Rutgers University VARIABLES

Addison-Wesley s JavaScript Reference Card Kathleen M. Goelz and Carol J. Schwartz, Rutgers University Javascript: A scripting language designed to be integrated into HTML code to produce enhanced, dynamic,

### Final Exam Review. CS 1428 Fall Jill Seaman. Final Exam

Final Exam Review CS 1428 Fall 2011 Jill Seaman 1 Final Exam Friday, December 9, 11:00am to 1:30pm Derr 241 (here) Closed book, closed notes, clean desk Comprehensive (covers entire course) 25% of your

### Standard printing function in C is printf Prints everything numbers, strings, etc. May be complex to use. Standard C library is called libc

Arrays and Structs and Pointers, Oh My! Programming in C Input and output Using printf Standard input and output Pointers Arrays Structures Combining these things together Arrays and Structs and Pointers,

### Problem 2 Add the two 2 s complement signed 8-bit values given below, and express your answer in decimal.

Problem 1 Recall the definition of root in project 1. (The declaration of struct entrynode appears below.) struct entrynode * root; Give the type of each of the following expressions. The answer may be

### PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :

### GTU Questions. Computer Programming & Utilization. Chief Course Coordinator Prof. Mitul K.Patel. (Head of Department & Assistant Professor)

GTU Questions Computer Programming & Utilization Chief Course Coordinator Prof. Mitul K.Patel (Head of Department & Assistant Professor) Course Coordinator Prof. Vrutti D. Shah (Assistant Professor) Lab

### The C Programming Language course syllabus associate level

TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

### The programming language C. sws1 1

The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

### Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. ==

Group 1 Question 1. What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value. Question 2. What is the only

### Thinking in C. Darin Brezeale. March 25, 2010

Thinking in C Darin Brezeale March 25, 2010 NOTE: This is definitely a work in progress. 1 Introduction One of the most difficult parts of learning to program is knowing how to deconstruct a problem in

### 12 INPUT AND OUTPUT OF DATA

12 INPUT AND OUTPUT OF DATA 12.1 INTRODUCTION In C language input and output of data is done by a collection of library functions like getchar, putchar, scanf, printf, gets and puts. These functions permit

### Java Review (Essentials of Java for Hadoop)

Java Review (Essentials of Java for Hadoop) Have You Joined Our LinkedIn Group? What is Java? Java JRE - Java is not just a programming language but it is a complete platform for object oriented programming.

### CIS 190: C/C++ Programming. Lecture 1 Introduction and Getting Started

CIS 190: C/C++ Programming Lecture 1 Introduction and Getting Started This course will teach you the basics of C and C++ give you more programming experience be appropriate for majors and non-majors not

### arrays C Programming Language - Arrays

arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

### Huazhong University of Science and Technology JAVA Programming Language Lecture 2:Variables and Data Types

JAVA Programming Language Lecture 2:Variables and Data Types Chengwei Zhang ( 张成伟 ) School of Electronic Information and Communications Huazhong University of Science and Technology Mar. 2015 Outline Quick

### strsep exercises Introduction C strings Arrays of char

strsep exercises Introduction The standard library function strsep enables a C programmer to parse or decompose a string into substrings, each terminated by a specified character. The goals of this document

### Variables and Constants. Variable A location in computer's memory in which a value may be stored from which that value may be retrieved

Variables and Constants Variable A location in computer's memory in which a value may be stored from which that value may be retrieved Storage of Variables Setting Aside Memory Defining a variable in C++

### School of Informatics, University of Edinburgh

CS1Ah Lecture Note 5 Java Expressions Many Java statements can contain expressions, which are program phrases that tell how to compute a data value. Expressions can involve arithmetic calculation and method

### 6.087 Lecture 5 January 15, 2010

6.087 Lecture 5 January 15, 2010 Review Pointers and Memory Addresses Physical and Virtual Memory Addressing and Indirection Functions with Multiple Outputs Arrays and Pointer Arithmetic Strings String

### Lecture P1: Introduction to C

Learning to Program Lecture P1: Introduction to C Programming is learned with practice and patience. Don t expect to learn solely from these lectures. Do exercises. Experiment and write lots of code. printf("this

### Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to