C++_ MARKS 40 MIN

Similar documents
I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

CS201 Latest Solved MCQs

STRUCTURING OF PROGRAM

AN OVERVIEW OF C++ 1

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

C++ 8. Constructors and Destructors

Interview Questions of C++

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

CS201- Introduction to Programming Current Quizzes

Fast Introduction to Object Oriented Programming and C++

Scientific Computing

C++ PROGRAMMING LANGUAGE: DYNAMIC MEMORY ALLOCATION AND EXCEPTION IN C++. CAAM 519, CHAPTER 15

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

21. Exceptions. Advanced Concepts: // exceptions #include <iostream> using namespace std;

6.096 Introduction to C++ January (IAP) 2009

Exceptions, Case Study-Exception handling in C++.

Short Notes of CS201

Absolute C++ Walter Savitch

CMSC 202 Midterm Exam 1 Fall 2015

CS201 - Introduction to Programming Glossary By

Introduction to C++ Systems Programming

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

Variables. Data Types.

Introduction to Programming Using Java (98-388)

Non-numeric types, boolean types, arithmetic. operators. Comp Sci 1570 Introduction to C++ Non-numeric types. const. Reserved words.

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

Inheritance, and Polymorphism.

CS304 Object Oriented Programming Final Term

C++ Quick Guide. Advertisements

CAAM 420 Fall 2012 Lecture 29. Duncan Eddy

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

Come and join us at WebLyceum

CS3157: Advanced Programming. Outline

Padasalai.Net s Model Question Paper

Object Oriented Programming. Solved MCQs - Part 2

Chapter 2. Procedural Programming

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Tokens, Expressions and Control Structures

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

Chapter 15 - C++ As A "Better C"

Object-Oriented Programming, Iouliia Skliarova

cs3157: c++ lecture #2 (mon-11-apr-2005) chronology of some programming languages... C++ vs Java identifiers.

Abstract Data Types (ADTs) 1. Legal Values. Client Code for Rational ADT. ADT Design. CS 247: Software Engineering Principles

Extending Classes (contd.) (Chapter 15) Questions:

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING

Object-Oriented Programming (OOP) Fundamental Principles of OOP

COEN244: Class & function templates

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++

What does it mean by information hiding? What are the advantages of it? {5 Marks}

CS 247: Software Engineering Principles. ADT Design

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

CPSC 427: Object-Oriented Programming

II BSC CS [ Batch] Semester III Core: Object Oriented Programming with C Plus Plus - 307B Multiple Choice Questions.

CPE Summer 2015 Exam I (150 pts) June 18, 2015

CSCE 110 PROGRAMMING FUNDAMENTALS

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ (Non for C Programmer) (BT307) 40 Hours

Understanding main() function Input/Output Streams

G52CPP C++ Programming Lecture 17

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

CSI33 Data Structures

TEMPLATES AND EXCEPTION HANDLING

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program:

Midterm Review. PIC 10B Spring 2018

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

OBJ. ORI.& MULT. PROG., M.C.Q. BANK, FOR UNIT -2, SECOND YEAR COMP. ENGG. SEM-4, 2012 PATTERN, U.O.P. UNIT-2

Laboratorio di Tecnologie dell'informazione

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

The Hong Kong Polytechnic University Faculty of Engineering

UEE1302 (1102) F10: Introduction to Computers and Programming

Constructor - example

A SHORT COURSE ON C++

CS 162, Lecture 25: Exam II Review. 30 May 2018

PHY4321 Summary Notes

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak

This examination has 11 pages. Check that you have a complete paper.

Review: C++ Basic Concepts. Dr. Yingwu Zhu

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING

C Legacy Code Topics. Objectives. In this appendix you ll:

Introduction to Programming using C++

Programming, numerics and optimization

Programming in C++: Assignment Week 8

Lab 2: ADT Design & Implementation

IBS Technical Interview Questions

1. The term STL stands for?

CS 376b Computer Vision

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

COMP322 - Introduction to C++

2 ADT Programming User-defined abstract data types

Computer Programming : C++

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

ME240 Computation for Mechanical Engineering. Lecture 4. C++ Data Types

Object Oriented Programming

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

+2 Volume II OBJECT TECHNOLOGY OBJECTIVE QUESTIONS R.Sreenivasan SanThome HSS, Chennai-4. Chapter -1

Object-Oriented Programming for Scientific Computing

Transcription:

C++_16.9.2018 40 MARKS 40 MIN https://tinyurl.com/ya62ayzs 1) Declaration of a pointer more than once may cause A. Error B. Abort C. Trap D. Null 2Whice is not a correct variable type in C++? A. float B. real C. int D. double 3. Which operation is used as Logical 'AND' A. Operator-& B. Operator- C. Operator-&&D. Operator + 4 An expression A.B in C++ means A. A is member of object B B. B is member of Object A C. Productof A and B D. None of these 5 A C++ code line ends with A. A Semicolon (;) B. A Fullstop(.) C. A Comma (,) D. A Slash (/) 6 function is used to allocate space for array in memory. A. malloc() B. realloc() C. alloc() D. calloc() 7 A pointer pointing to a variable that is not initialized is called A. Void Pointer B. Null Pointer C. Empty Pointer D. Wild Pointer

8 Default constructor has arguments. A. No argument B. One Argument C. Two Argument D. None of these 9 A class whos objects can not be created is known as A. Absurd Class B. Dead Class C. Super Class D. Abstract Class 10 Which class allows only one object to be created. A. Nuclear Family Class B. Abstruct Class C. Sigleton Class D. Numero Uno Class 11 Reusability of code in C++ is achieved through A. Polymorphism B. Inheritance C. Encapsulation D. Both A and B 12In CPP, members of a class are by default. A. Public B. Private C. protected D. Static 13In C++ Program, inline fuctions are expanded during A. Run Time B. Compile Time C. Debug Time D. Coding Time 14To perfor file input / output operation in C++, we must include which header file? A. <fiostream> B. <ifstream> C. <ofstream> D. <fstream>

15 An exceptio in C++ can be generated using which keywords. A. thrown B. threw C. throw D. throws Consider the following program: #include <iostream> #include <string> using namespace std; int main () string str = "This*is^a.45min test."; int i; for (i = 0; i < str.length( ); i++) if (ispunct(str[i])) str[i] = ; // a blank str[i] = tolower (str[i]); cout << str; 16 What is printed by the last line of the code? A. this*is^a.45min test. B. thisisa45mintest C. this is a 45min test D. this is a 45min test. 17 What is cout? A. It is a function B. It is an operator C. It is a class D. It is an object (class instance) E. It is a reserved word (C++ keyword) 18 Given below are some statements about the default (0- argument) constructor: I. Its return type is the type of the class II. It has no return type III. The programmer can define it, but the C++ language doesn t require this IV. The programmer must define it V. It is always defined by C++ if it isn t provided by the programmer

VI. It is sometimes, but not always, defined by C++ if it isn t provided by the programmer Which of these statements are true? A. I, III and V only B. I, II and VI only C. II and IV only D.II, III and V only E. II, III and VI only 19Which of the following functions will correctly return True if its argument is an odd integer? I. bool IsOdd (int x) return (x % 2 == 1); II. bool IsOdd (int x) return (x / 2 == 1); III. bool IsOdd (int x) if (x % 2 == 1) return true; else return false; A. II only B. I and II only C. I and III only D. II and III only E. I, II and III 20 When an ADT is implemented as a C++ class, which of the following should normally be true? A. Member functions are private, member variables are public

B. Member functions are public, member variables are private C. Member functions as well as member variables are private D. Member functions as well as member variables are public 21. If the class name is X, what is the type of its this pointer (in a nonstatic, non-const member function)? a. const X* const b. X* const c. X* d. X&* 22. Which classes allow primitive types to be accessed as objects? a. Storage b. Virtual c. Friend d. Wrapper

23. When is std::bad_alloc exception thrown? a. When new operator cannot allocate memory b. When alloc function fails c. When type requested for new operation is considered bad, this exception is thrown d. When delete operator cannot delete the allocated (corrupted) object 24. Which one of the following is not a fundamental data type in C++ a. float b. string c. int d. wchar_t 25. Which of the following is a valid destructor of the class name Country a. int ~Country()

b. void Country() c. int ~Country(Country obj) d. void ~Country() 26. Which of the following correctly describes C++ language? a. Statically typed language b. Dynamically typed language c. Both Statically and dynamically typed language d. Type-less language 27. Which of the following keyword supports dynamic method resolution? a. abstract b. Virtual c. Dynamic d. Typeid

28. Which of the following is the most preferred way of throwing and handling exceptions? a. Throw by value and catch by reference. b. Throw by reference and catch by reference. c. Throw by value and catch by value d. Throw the pointer value and provide catch for the pointer type. 29. Which of the following is not true about preprocessor directives a. They begin with a hash symbol b. They are processed by a preprocessor c. They form an integral part of the code d. They have to end with a semi colon 30. What s wrong? while( (i < 10) && (i > 24)) a. the logical operator && cannot be used in a test condition

b. the while loop is an exit-condition loop c. the test condition is always false d. the test condition is always true 31 In the following function: int f (int n) int v; v = 2*n+1; return v; What is the storage class of variable v? A. static B. dynamic C. contextual D. automatic E. inline 32 Consider this piece of code: void mysterious(int i, int &k) i = 1; k = 2; int main () int x = 0; mysterious (x, x); cout << x << endl; return 0; What is the value of x that gets printed by the main? A. 0 B. 1 C. 2 D. None of these 33 Consider the following class: class FooBar public: void f1 (string s); void f2 (const string &s); void f3 (string s) const; private: string str; ; Which of the three member functions could legally alter

member variable str? A. The function f1 only B. The function f2 only C. The function f3 only D. Two of them E. All three of them 34 The output of this program is int main () cout << Hello World! return 0; a. Hello World b. Syntax error c. 0 d. Hello World! 35 Observe following program and answer class Example public: int a,b,c; Example()a=b=c=1; //Constructor 1 Example(int a)a = a; b = c = 1; //Constructor 2 Example(int a,int b)a = a; b = b; c = 1; //Constructor 3 Example(int a,int b,int c) a = a; b = b; c = c; //Constructor 4 In the above example of constructor overloading, the following statement will call which constructor Example obj = new Example (1,2,3); a. Constructor 2 b. Constructor 4 c. Constrcutor 1 d. Type mismatch error 36 The output of this program is int a = 10; void main() int a = 20; cout << a << ::a; a. Syntax error b. 10 20 c. 20 10 d. 20 20

37 The output of int a = 5; int b = 10; cout << (a>b?a:b); a. 5 b. 10 c. Syntax error d. None of above 38What is the output of this program? #include using namespace std; int main() int a; a = 5 + 3 * 5; cout << a; return 0; A 35 B 20 C 25 D 30 39. What is the output of the program #include<iostream.h> void main() int n=1; cout<<endl<< The numbers are; <<endl; do cout <<n<< t ; n++; while (n<=100); cout <<endl; A) Print natural numbers 0 to 99 B) Print natural numbers 1 to 99

C) Print natural numbers 0 to 100 D) Print natural numbers 1 to 100 40 The keyword used to transfer control from a function back to the calling function is A. switch B. goto C. go back D. return