Course "Data Processing" Name: Master-1: Nuclear Energy Session /2018 Examen - Part A Page 1

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

Short Notes of CS201

CS201 - Introduction to Programming Glossary By

Unit 1 : Principles of object oriented programming

KLiC C++ Programming. (KLiC Certificate in C++ Programming)

Topics. bool and string types input/output library functions comments memory allocation templates classes

Introduction to C++ (Extensions to C)

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

Interview Questions of C++

BITG 1113: Function (Part 2) LECTURE 5

IS 0020 Program Design and Software Tools

OBJECT-ORIENTED PROGRAMMING CONCEPTS-CLASSES II

Piyush Kumar. input data. both cout and cin are data objects and are defined as classes ( type istream ) class

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University

EL2310 Scientific Programming

CS3157: Advanced Programming. Outline

C++ Input/Output: Streams

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays

Absolute C++ Walter Savitch

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!

Introduction to C++ Introduction to C++ 1

C++ As A "Better C" Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan.

Chapter 2. Procedural Programming

Classes - 2. Data Processing Course, I. Hrivnacova, IPN Orsay

COMP322 - Introduction to C++

Syllabus of C++ Software for Hands-on Learning: This course offers the following modules: Module 1: Getting Started with C++ Programming

Operator overloading

Input and Output. Data Processing Course, I. Hrivnacova, IPN Orsay

C++ Programming Fundamentals

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

STL components. STL: C++ Standard Library Standard Template Library (STL) Main Ideas. Components. Encapsulates complex data structures and algorithms

CPSC 427: Object-Oriented Programming

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

C++ Programming Fundamentals

CSc Introduc/on to Compu/ng. Lecture 19 Edgardo Molina Fall 2011 City College of New York

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

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

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

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FACULTY INFORMATION TECHNOLOGY AND COMMUNICATION (FTMK) BITE 1513 GAME PROGRAMMING I.

Introduction to C++ Systems Programming

COMP322 - Introduction to C++

Operator Overloading in C++ Systems Programming

EL2310 Scientific Programming

Exam 3 Chapters 7 & 9

Inheritance, and Polymorphism.

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team

Program Organization and Comments

C++ For Science and Engineering Lecture 2

Linked List using a Sentinel

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A.

Preview 8/28/2018. Review for COSC 120 (File Processing: Reading Data From a File)

Come and join us at WebLyceum

Pointers and References

Streams. Rupesh Nasre.

Object-Oriented Programming

C++ Important Questions with Answers

CS2255 HOMEWORK #1 Fall 2012

An Object Oriented Programming with C

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

Polymorphism. Zimmer CSCI 330

Constructor - example

CIS 190: C/C++ Programming. Classes in C++

C++ Programming Fundamentals

Wentworth Institute of Technology COMP201 Computer Science II Spring 2015 Derbinsky. C++ Kitchen Sink. Lecture 14.

Recharge (int, int, int); //constructor declared void disply();

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; }

CSC1322 Object-Oriented Programming Concepts

IS 0020 Program Design and Software Tools

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:

Polymorphism Part 1 1

Module C++ I/O System Basics

I/O Streams and Standard I/O Devices (cont d.)

CS201 Some Important Definitions

Ch02. True/False Indicate whether the statement is true or false.

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

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

Lecture 4 Tao Wang 1

Lecture 10. Command line arguments Character handling library void* String manipulation (copying, searching, etc.)

Classes and Objects. Class scope: - private members are only accessible by the class methods.

Implementing Abstract Data Types (ADT) using Classes

Data Structures using OOP C++ Lecture 3

Cpt S 122 Data Structures. Introduction to C++ Part II

CS201 Latest Solved MCQs

CSE 333 Lecture 9 - intro to C++

G52CPP C++ Programming Lecture 18

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

Grades. Notes (by question) Score Num Students Approx Grade A 90s 7 A 80s 20 B 70s 9 C 60s 9 C

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

CS2141 Software Development using C/C++ Stream I/O

Communication With the Outside World

CE221 Programming in C++ Part 2 References and Pointers, Arrays and Strings

EL2310 Scientific Programming

CS2141 Software Development using C/C++ C++ Basics

Evolution of Programming Languages

Functions, Arrays & Structs

Classes. Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT).

Transcription:

Examen - Part A Page 1 1. mydir directory contains three files: filea.txt fileb.txt filec.txt. How many files will be in the directory after performing the following operations: $ ls filea.txt fileb.txt filec.txt $ mv filea.txt filed.txt $ mv filed.txt filee.txt $ rm fileb.txt $ cp filec.txt filef.txt $ cp filec.txt fileg.txt 2. Complete missing words in the following statement: The function main() in a C++ program returns a value of If return statement is not present, the value = is returned implicitly type. 3. How many times will the following code print each message? for ( int i = 0; i < 10; i++ ) { cout << "Looping over i" << endl; if ( i == 5 ) continue; for ( int j = 0; j < 10; j++ ) { cout << "Looping over j" << endl; if ( j == 5 ) break; "Looping over i" will be printed "Looping over j" will be printed times. times. 4. To share a completely new file in your directory with your team using git, which command is not necessary: a) git add b) git commit c) git push d) git log

Examen - Part A Page 2 5. Which objects for the input/output (I/O) functionality are provided with #include <iostream>? (Select the correct statement.) a) The cin and cout, which correspond to the standard input stream and services useful for performing formatted I/O with so-called parameterized stream manipulators, such as setw and setprecision. b) The cin and cout, which correspond to the standard input stream and the standard output stream, and the cerr and clog, which correspond to the un-buffered and buffered standard error stream. c) The cin and cout, which correspond to the standard input stream and the standard output stream, and services for user-controlled file processing. d) The cin and cout which correspond to the standard input stream and the standard output stream. 6. Let's have: vector<int> numbers = { 1, -1, 2, -2; numbers.push_back(3); numbers.push_back(-3); numbers.size(); numbers.push_back(4); numbers.push_back(-4); numbers.push_back(5); numbers.push_back(-5); What will be the number of elements in the 'numbers' vector after the last statement? 7. What does "Data encapsulation" mean in object-oriented programming?

Examen - Part A Page 3 8. Which code can be used to get the reference of the following variable: double x = 3.5; a) double& rx = x; b) double& rx = *x; c) double* rx = &x; d) double* rx = *x; 9. Which of the statements below is correct? int main() { for ( int i = 0; i < 10; i++ ) { int value1 = 5; int* value2 = new int(10); cout << End of program << endl; a) the memory allocated for both value1 and value2 will be released before printing the message b) the memory allocated for both value1 and value2 will be released after printing the message c) the memory allocated for value1 will be released before printing the message and for value2 after this printing d) the memory allocated for value1 will be released after printing the message and for value2 before this printing 10. Which of the statements below is incorrect? A class constructor function is different from an ordinary function in the following aspects: a) The name of the constructor is the same as the class name. b) Constructor has no return type. Hence, no return statement is allowed inside the constructor's body. c) Constructor cannot be overloaded. d) Constructor can only be invoked once to initialize the instance constructed.

Examen - Part A Page 4 11. The common behavior of objects can be expressed by means of inheritance, we can define a derived class that inherits data and functions of the base class. A member function of a base class can be also redefined in its derived classes, if it is declared with keyword virtual. Non virtual functions with the same name in a class hierarchy should be however avoided. Could you explain why? 12. What are the values of c and e variables after the following instructions? int c=2, e=5; e++; c=e++; c++; a) c=3, e=7 b) c=8, e=7 c) c=7, e=7 d) c=3, e=6 13. Which of the statements below is correct? a) A C++ program can output information only through <iostream>. b) A C++ program can output information through <iostream> and with a return code. c) A C++ program can output information with the main function argc, argv[] arguments. d) A C++ program can output information through others functions arguments. 14. Which of the following function declarations guarantee(s) that the argument will not be modified in the function? a) void fun1 (int* number); b) void fun2 (int& number); c) void fun2 (int number); d) void fun2 (const int& number);

Examen - Part A Page 5 15. Given the following function prototype: int funct (int a, int b, int c = 3); which of the following calls will fail at compilation? a) int i = funct (2, 3, 4); b) int j = funct (2); c) int k = funct (2, 3); d) int l = funct (1, 2, 3); 16. Given the executable program compute, how can you display the return value (called also exit code) of the program in the terminal? a) > echo compute b) > print compute c) >./compute > echo $? d)>./compute > echo argc 17. Can a C++ program call another program? a) Yes, using the system() function defined in <cstdlib> header. b) Yes, using the exec()function defined in <cstdlib> header. c) Yes, using the system() function defined in <execution> header. d) No, another program can only be called by the operational system. 19. What s the purpose of using Git and Make tools? Name at least one benefit of each of these tools.

Examen - Part A Page 6 18. Qt library introduces a special mechanism for communication between the Qt objects (buttons, windows, menus). a) Could you name some of the Qt specific keywords, functions or macros which are defined for this mechanism? b) Could you explain meaning of one of these keywords? a) b) 20. What is the meaning of nullptr? a) If a pointer has nullptr value, it means that the pointer variable is not yet defined and cannot be used in the program. b) If a pointer has nullptr value, it means that it is not yet initialized. It can point anywhere. c) If a pointer has nullptr value, it does not refer to anything. This value is attributed to a pointer by default when a variable of pointer type is defined. d) If a pointer has nullptr value, it does not refer to anything. This is different from a noninitialized pointer, which can point anywhere.