MIT Aurangabad FE Computer Engineering

Similar documents
Sources: On the Web: Slides will be available on:

Senem Kumova Metin & Ilker Korkmaz 1

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

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

Two-way selection. Branching and Looping

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

C PROGRAMMING FOR MATHEMATICAL COMPUTING

Informatica e Sistemi in Tempo Reale

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

Computer Programming Tutorial

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

Chapter One Introduction to Programming

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Introduction to Java

6. Control Structures

VB.NET Programming Fundamentals

arrays C Programming Language - Arrays

The C Programming Language course syllabus associate level

Computer Science 2nd Year Solved Exercise. Programs 3/4/2013. Aumir Shabbir Pakistan School & College Muscat. Important. Chapter # 3.

C++ Programming Language

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

JavaScript: Control Statements I

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

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

The C Programming Language

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

ALGORITHMS AND FLOWCHARTS

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Lecture 2 Notes: Flow of Control

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall

MATLAB Programming. Problem 1: Sequential

So far we have considered only numeric processing, i.e. processing of numeric data represented

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

Object Oriented Software Design

Object Oriented Software Design

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Tutorial on C Language Programming

Example of a Java program

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Fundamentals of Programming

Passing 1D arrays to functions.

C Language Tutorial. Version March, 1999

I PUC - Computer Science. Practical s Syllabus. Contents

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

C++ INTERVIEW QUESTIONS

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

The programming language C. sws1 1

13 Classes & Objects with Constructors/Destructors

Outline. Conditional Statements. Logical Data in C. Logical Expressions. Relational Examples. Relational Operators

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

In this Chapter you ll learn:

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Flowchart Techniques

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Answers to Review Questions Chapter 7

Computer Programming Lecturer: Dr. Laith Abdullah Mohammed

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Moving from CS 61A Scheme to CS 61B Java

Introduction to Python

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Fundamentals of Programming and Software Development Lesson Objectives

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Java Interview Questions and Answers

Lexical Analysis and Scanning. Honors Compilers Feb 5 th 2001 Robert Dewar

Chapter 13 - The Preprocessor

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Keil C51 Cross Compiler

C++ Language Tutorial

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

Visual Logic Instructions and Assignments

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

Exercise 4 Learning Python language fundamentals

Stacks. Linear data structures

Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Pemrograman Dasar. Basic Elements Of Java

El Dorado Union High School District Educational Services

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

3/13/2012. Writing Simple C Programs. ESc101: Decision making using if-else and switch statements. Writing Simple C Programs

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

CS1010 Programming Methodology A beginning in problem solving in Computer Science. Aaron Tan 20 July 2015

System Calls and Standard I/O

OpenOffice.org 3.2 BASIC Guide

A brief introduction to C++ and Interfacing with Excel

Moving from C++ to VBA

CP Lab 2: Writing programs for simple arithmetic problems

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June Dr.-Ing.

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Unit 6. Loop statements

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

1 Introduction. 2 Overview of the Tool. Program Visualization Tool for Educational Code Analysis

Python Lists and Loops

Transcription:

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 +32767 c. 3.4e-38 to 3.4e+38 b. -128 to +127 d. none of these 3. Characters usually stored in----byte a.1 byte c. 2 byte b. 4 byte d. none of these 4. A character constant is a single alphabet, a single digit or a single special symbol enclosed in? a. Single quotes c. Floating b. Double quotes d. None of these 5. Comments are. A. Executable statements C. Assignment statements B. Non executable statements D. Input/Output statements 6. Blank spaces are allowed while declaring variable. a. True b. False 7. Which of the following is legal variable name? abc 1, stud_1, view1-a, ans2^3 a. abc 1 b. stud_1 b. view1-a d. ans2^3 8. In C language reading data from keyboard? a. printf() c. scanf() b. int d. main() 9. The real constants could be written in a. Fractional form only c. ASCII form only b. Exponential form d. Both Fractional and Exponential form 10. Which of the following is not valid data type? a. int c. float b. char d. main 11. which of the following is odd one out a. + c. - b. & d. % 12. In a C language && is a?

a. Relational operator c. Logical operator b. Arithmetic operators d. None of these 13. Which of the following is not relational Operator a. >= c. * b. == d. < 14. Which of the following is not Logical Operator a. c. < b. && d.! 15. Values of data items of types int, float, char are displayed by writing in printf statement in C A. %d, %f, %s C. %d, %d, %c B. %f, %d, %c D. %d, %f, %c 16. if a=3, b=0 and c=-4, what is the value of the expression a && b c A. 1 C. 3 B. 2 D. 4 17. Basic symbols of flow chart are. A. Start and End C. Input Output B. Processing, Decision D. All of above 18. Diamond shape in flow chart denotes. A. Start C. End B. Decision D. Input - Output task 19. Which of the following is used for representing a Conditional Statement in a Flow chart A. Parallelogram C. Trapezoid B. Rhombus D. Rectangle 20. Amongst the flowchart symbols, which of the following is an Auxiliary symbol? A. Sequence C. Decision B. Connector D. Repetition 1. is used to write the algorithms. A. Computer Language C C. Computer Language C++ B. Any Programming Language D. English Language 21. Algorithm halts in A. Finite time C. Logarithmic time B. Infinite time D. Exponential time 22. C programs are converted into machine language with the help of A. An Editor C. An Operating System B. A Compiler D. An interpreter 23. Which are the types of errors that can occur in a computer program? A. Logical errors C. Both A and B B. Syntax errors D. None of these 24. What is output of following program?

#include<stdio.h> #include<conio.h> void main() { int a=7,b=2,c,d; c=a%b; d=a/b; printf( c=%d \n,c); printf( d=%d\n,d); getch(); } a. c=3.5, d=1 c. c=1, d=3 b. c=1, d=3.500000 d. none of these 25. What is the following program doing? main () { int d = 1; do printf( %d\n, d++); while (d < = 9);} (A) Adding 9 integers (B) Adding integers from 1 to 9 (C) Displaying integers from 1 to 9 (D) None of these

Unit 5: Data Input Output, Decision Control and Loop Control Structure: 1. The output of the code below is #include <stdio.h> void main() { int x = 5; if (x < 1) printf("hello"); if (x == 5) printf("hi"); else printf("no"); } a) hi b) hello c) no d) None of the mentioned Answer: (a) 2. The output of the code below is 1. #include <stdio.h> 2. int x; 3. void main() 4. { 5. if (x) 6. printf("hi"); 7. else 8. printf("how are u"); 9. } a) hi b) how are you c) Compile time error d) None of the mentioned Answer: (b) 3. Comment on the following code below 1. #include <stdio.h> 2. void main() 3. { 4. int x = 5; 5. if (true); 6. printf("hello"); 7. } a) It will display hello b) It will throw an error

c) Nothing will be displayed d) Compiler dependent Answer: (b) 4. The output of the code below is 1. #include <stdio.h> 2. void main() 3. { 4. int x = 0; 5. if (x == 0) 6. printf("hi"); 7. else 8. printf("how are u"); 9. printf("hello"); 10. } a) Hi c) hello b) how are you d) hihello Answer: (d) 5. The output of the code below is 1. #include <stdio.h> 2. void main() 3. { 4. int x = 5; 5. if (x < 1); 6. printf("hello"); 7. 8. } a) Nothing b) Run time error c) Hello d) Varies Answer: (c) 6. What will be the output of the sample code shown above? void main() { int a=12,b=12; if(a==b) printf( a and b are equal ); } a) 12 c) compile time error b) run time error d) a and b are equal Answer: (d) 7. The output of the code below is(when 1 is entered)

1. #include <stdio.h> 2. void main() 3. { 4. char *ch; 5. printf("enter a value btw 1 to 3:"); 6. scanf("%s", ch); 7. switch (ch) 8. { 9. case "1": 10. printf("1"); 11. break; 12. case "2": 13. printf("2"); 14. break; 15. } 16. } a) 1 b) 2 c) Compile time error d) No Compile time error Answer: (c) 8) What is the output of code: 1. #include <stdio.h> 2. int main() 3. { 4. int x = 1; 5. if (x > 0) 6. printf("inside if\n"); 7. else if (x > 0) 8. printf("inside elseif\n"); 9. } a) inside if b) inside elseif c) inside if inside elseif d) Compile time error Answer: (a) 9) What is the output of this C code? a) True c) false b) Compile time error d) Undefined behavior Answer: (c)

10) What is the output of this C code? 1. #include <stdio.h> 2. int main() 3. { 4. int x = 0; 5. if (x == 1) 6. { 7. if (x == 0) 8. printf("inside if\n"); 9. else 10. printf("inside else if\n"); 11. } 12. else 13. printf("inside else\n"); 14. } a) inside if b) inside else if c) inside else d) Compile time error Answer: (c) 11) What is the output of this C code? 1. #include <stdio.h> 2. int main() 3. { 4. if (printf("%d", printf("))) 5. printf("we are Happy"); 6. else if (printf("1")) 7. printf("we are Sad"); 8. } a) 0We are Happy b) 1We are Happy c) 1We are Sad d) Compile time error Answer: (d) 12) What is the output of this C code 1. #include <stdio.h> 2. const int a = 1, b = 2; 3. int main() 4. { 5. int x = 1; 6. switch (x) 7. { 8. case a: 9. printf("yes "); 10. case b: 11. printf("no\n");

12. break; 13. } 14. } a) yes no b) yes c) no d) Compile time error Answer: (d) 13) The Correct syntax for the ` for ` loop in ` C ` is. A. for(i=1; i<=5 ; i++) C. for(i=1, i<=5, i++) B. for(i=1: i<=5: i++) D. None of the above Answer: (a) 14) Comment on the output of this C code? main() { void fun(); int i=1; while(i<=5) { printf(\"%d\",i); if(i>2) goto here; } } a) Syntax Error : Undefined label 'here' b) No Error, Program run c) 1111 d) 11 Answer: (a) 15) In Do-While loop, statements are executed a. At least once c. both a & b b. More than once d. None of them Answer: (c) 16) Which statement is used to restart the loop skipping rest of the statements in loop? a. For statement c. Continue statement b. goto statement d. break statement Answer: (c) 17) Do-while loop is a. Entry controlled c. Break controlled b. Exit controlled d. None of these Answer: (b) 18) In do-while loop, loop condition is checked at the.

a. Beginning of loop c. End of program b. End of loop d. Start of program Answer: (b) 19) In following statement which is not a conditional statement a. break c. If.else b. Do..while d. All of them c. Answer: (a) 20) What is Nested if else statements means a. If else within if else c. only if then if..else b. Continuous if..else d. none of these Answer: (a) 21) The control statement that allows us to make a decision from number of choices is called as. A. if-else C. switch B. for D. do-while Answer: (c) 22) A case in ` switch ` statement is terminated by if control should not fall through the successive cases. A. Break C. ; B. break; D. break Answer: (b) 23) Goto statement is used for. A. Conditional jump only C. both conditional and unconditional jumps B. Unconditional jump only D. None of the above Answer: (b) 24) The Correct syntax for the ` for ` loop in ` C ` is. i. for(i=1; i<=5 ; i++) c. for(i=1, i<=5, i++) ii. for(i=1: i<=5: i++) d. None of the above Answer: (a) 25) If ` a ` is a variable defined in a ` C ` program then &a denotes the. A. content of a C. Both A and B B. address of a D. none of these Answer: (b) 26) getchar() function is used for a. Writing a Character c. Reading a Character b. Explaining a Character d. Printing a Character Answer: (c)

Unit 6: Arrays and Functions: Q.1 A function that calls itself is known as a) inline function b) nested function c) Overloaded function d) recursive function Answer: (d) Q.2 The return type of a function that does not have any return type is declared as a) long b) double c) int d) void Answer:( d) Q.3 Parameters passed to a function are separated with a) comma b) semicolon c) colon d) none of the above Answer: (a) Q.4 According to the following statements, select the best suitable statement int x=5,y=3,z; a=add(x,y) a) The function add is called by passing the values b) The function add is called by passing reference c) Both a& b above d )None of the above Answer=(a) Q.5 According to the following code, select the best suitable statement

int x=5,y=3,z; A=add(&x,&y) Answer:(b) a) The function add is called by passing the values b) The function add is called by passing reference c) Both a& b above d) None of the above Q.6 The return type of the function cannot be a)void b) main c) int Answer:(b) d) Float Q.7 Every program must have at least function(s). a) 1 b) 2 c) 3 Answer:(a) d) None of the above Q.8 In the function definition, the argument list must always be accompanied with the corresponding data type Answer:(a) a) True b) False Q.9 The value returned by a function is returned to the a) main function b) operating system c) caller function d) called function

Answer:(c) Q.10 The function that does not return any data is called as fuction a) void b) recursive c) int d) Float Answer:(a) Q.11 The parameters passed by the caller function are called as the parameters a) actual b) formal c) informal d) reference Answer:(a) Q.12 The parameters received by the called function are called as the parameters a) actual b) formal c) informal d) reference Answer:(b) Q.13 The number of actual and formal parameters a) can be different b) should not be the same c) should be same d) cannot be same Answer:(c) Q.14 The data type of actual and formal parameters a) can be different

Answer:(c) b) should not be the same c) should be same d) cannot be same Q.15 The prototype of a function can be written Answer:(c) a) only outside a function b) only inside a fuction c) both inside and outside a function d) only with prefix # Q.16 The prototype of a function should contain the data type of the parameters to be passed to that function Answer:(a) a) True b) False Q.17 The return type of the function and that of the variable accepting the returned value can be different Answer:(b) a) True b) False Q.18 The actual and formal parameters are Answer:(d) a) same variables with different names b) different variables with same memory locations c) different memory locations with same variable names d) different memory locations s with same or different names Q.19 Array is a collection of mixed data types a) True

b) False Answer:(b) Q.20 The starting index of an array is always a) 0 b) 1 c) 2 d) None of the above Answer:(a) Q.21 The index of the last element of an array of n elements will be a) n+1 b) n c) n-1 d)none of the above Answer:(c) Q.22 The memory space allocated to the array declared as: int a[10]; Will be bytes a) 10 b) 20 c) 30 d) 40 Answer:(b) Q.23 The memory space allocated to the array declared as: float a[10]; Will be bytes a)10 b) 20 c) 30 d) 40 Answer:(d) Q.24 To access an element of an array the operator is used

a) comma b) semicolon c) & Answer:(d) d) square brackets [] Q.25 The 10 th element of an array can be accessed as Answer:(b) a) a[8] b) a[9] c) a[10] d) a[11] Q.26 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 Answer:(c) 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. Q.27 Which of the following statements are correct about an array? 1:The array int num[26] can store 26 elements 2:The expression num[1] designates the very first element in the array 3: It is necessary to initialize the array at the time of declaration. 4: All of the above a) 1 b) 2 c) 3 d) 4 Answer:(a) Q.28. Maximum number of elements in the array declaration int a[5][8] is Answer:(D) A. 28 B. 32 C. 35 D. 40

Q.29 Array subscripts in C always start at a )-1 b) 1 c) 0 Answer:(c) d) Value provided by user Q.30. Set of values of the same type, which have a single name followed by an index is called a) function b) structure c) array d) union Answer:(c) Q.31 An array elements are stored in memory locations Answer: (a) a) sequential b) random c) sequential and random d) None of the above Q.32 What is the maximum no. of dimensions an array in c may have a)2 b)8 c)20 d)50 Answer: (e) e)theoretically no limitation. The only practical limits are memory size and compilers.