Section - Computer Science

Similar documents
Section - Computer Science. int main() {! int a=10,b=20;! printf("a:%d B:%d\n",a,b);! a=(a+b)-(b=a);! printf("a:%d B:%d\n",a,b);!

Pointers, Dynamic Data, and Reference Types

Midterm Review. PIC 10B Spring 2018

Short Notes of CS201

CS201- Introduction to Programming Current Quizzes

CS201 - Introduction to Programming Glossary By

Lecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions?

CSC 1600 Memory Layout for Unix Processes"

CS201 Some Important Definitions

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

The combination of pointers, structs, and dynamic memory allocation allow for creation of data structures

C Introduction. Comparison w/ Java, Memory Model, and Pointers

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

CS201 Latest Solved MCQs

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT


Dynamic Allocation of Memory

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS

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

Low-Level C Programming. Memory map Pointers Arrays Structures

Q1: /8 Q2: /30 Q3: /30 Q4: /32. Total: /100

C - Basics, Bitwise Operator. Zhaoguo Wang

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #07. Topic: Pointer in C Date:

a data type is Types

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ.

Linked List using a Sentinel

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018

CMSC 313 Spring 2010 Exam 3 May 17, 2010

Structured Data. CIS 15 : Spring 2007

o Code, executable, and process o Main memory vs. virtual memory

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

Run Time Environment

1. Which of the following best describes the situation after Line 1 has been executed?

C++ Programming Lecture 4 Software Engineering Group

Introduction to Computer Science Midterm 3 Fall, Points

For Teacher's Use Only Q No Total Q No Q No

In Java we have the keyword null, which is the value of an uninitialized reference type

Come and join us at WebLyceum

C++_ MARKS 40 MIN

Chapter 2 (Dynamic variable (i.e. pointer), Static variable)

Processes. Johan Montelius KTH

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

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

Final CSE 131B Spring 2004

Instructions: Submit your answers to these questions to the Curator as OQ02 by the posted due date and time. No late submissions will be accepted.

CS261: HOMEWORK 2 Due 04/13/2012, at 2pm

A process. the stack

MM1_ doc Page E-1 of 12 Rüdiger Siol :21

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)

MPATE-GE 2618: C Programming for Music Technology. Syllabus

School of Information Technology and Computer Science CSCI192 - Spring Session Revision

Introduction to C Language (M3-R )

CSCI 2132 Software Development. Lecture 29: Dynamic Memory Allocation

Presented By : Gaurav Juneja

Classes. C++ Object Oriented Programming Pei-yih Ting NTOU CS

cout << "How many numbers would you like to type? "; cin >> memsize; p = new int[memsize];

C Multiple Choice Questions and answers MCQ with Ans.

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer:

Tokens, Expressions and Control Structures

Largest Online Community of VU Students

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community

Common Misunderstandings from Exam 1 Material

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

Quiz 0 Review Session. October 13th, 2014

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

CSE 333 Midterm Exam Cinco de Mayo, 2017 (May 5) Name UW ID#

Fast Introduction to Object Oriented Programming and C++

Abstract Data Types. Different Views of Data:

C++ Tutorial AM 225. Dan Fortunato

Reminder: compiling & linking

APSC 160 Review Part 2

Lecture Notes on Memory Layout

Lab 2: Pointers. //declare a pointer variable ptr1 pointing to x. //change the value of x to 10 through ptr1

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

Kurt Schmidt. October 30, 2018

Final CSE 131B Spring 2005

Practice Sheet #07 with Solutions

C++FA 6.1 PRACTICE FINAL EXAM

CS 103 Unit 11. Linked Lists. Mark Redekopp

Suppose we find the following function in a file: int Abc::xyz(int z) { return 2 * z + 1; }

An Introduction to C++

double d0, d1, d2, d3; double * dp = new double[4]; double da[4];

Operating System Labs. Yuanbin Wu

A3-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH 'C' LANGUAGE

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

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #1 Examination 12:30 noon, Tuesday, February 14, 2012

Creating a C++ Program

What is Class? Remember

Final Exam. Name: Student ID: Section: Signature:

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

PROGRAMMING IN C++ KAUSIK DATTA 18-Oct-2017

Chapter-8 DATA TYPES. Introduction. Variable:

Intermediate Programming, Spring 2017*

Lecture 03 Bits, Bytes and Data Types

Pointers review. int a = 5; int *ptr = &a; cout << *ptr;

Variables, Memory and Pointers

Introduction to Linked Lists

Documentation. Programming / Documentation Slide 42

EMBEDDED SYSTEMS PROGRAMMING Language Basics

Transcription:

Section - Computer Science 1. With respect to the C++ programming language, which is the parameter that is added to every non-static member function when it is called? (i) this pointer (ii) that pointer (iii) datatype 2. A process executes the code: (i) 3 (ii) 4 (iii) 7 (iv) 8 fork (); fork (); fork (); 3. Consider the following piece of code: if( a > 10 ) if( b < 5 ) b = a * 10; else if( a < 5 ) if ( b > 10 ) b = a * b; else if( c > 5 && b == 10 ) if( c < 10 ) c = b * a; else c = a * c; The compiler will (i) associate the first else statement with if( b < 5 ) (ii) associate the first else statement with if( a > 10 ) (iii) throw an error outright (iv) none of the above 4. What will be the result of the following C language program? void int const *p = 5; printf("%d",++(*p));

(i) 6 (ii) 5 (iii) Linker error (iv) Compiler error 5. What will be the result of the following C language program? int a = 0; int b = 20; char x = 1; char y = 10; if(a,b,x,y) printf("welcome"); (i) Welcome (ii) Blank (iii) Compiler error (iv) Linker error 6. Increasing the Random Access Memory (RAM) of a computer typically improves performance because (i) Virtual memory increases (ii) Larger RAMs are faster (iii) Fewer page faults occur (iv) Fewer segmentation faults occur 7. What will be the result of the following C language program? struct date; struct student char name[30]; struct date dob; stud; struct date int day, month, year; ; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month); (i) Compiler error: Undefined structure dob (ii) Compiler error: Undefined structure name (iii) Compiler error: Undefined structure date (iv) Linker error

8. What does the following C language declaration mean? int (*decl)[30] (i) array[30] of pointer to int (ii) function returning pointer to int 30 (iii) pointer to array[30] of int 9. Which of the following statements is not true? (i) A memory leak occurs when a program loses the ability to free a block of dynamically allocated memory. (ii) Objects that point to other objects are called null objects. (iii) A handle class is a class that maintains a pointer to an object that is programmatically accessible through the public interface of the handle class. (iv) A common form of an action class is a simple class containing just one virtual function. 10. Which of the following statements is not true? (i) NULL can be a value for pointer type variables. (ii) VOID is type identifier which has no size. (iii) null *ptr = VOID (iv) void *ptr = NULL 11. What will be the result of the following C language program? (i) 258 0 (ii) 1 0 (iii) 1 2 (iv) 2 1 int i = 258; int *iptr = &i; printf("%d %d", *((char*)iptr), *((char*)iptr+1) ); 12. In a C++ language program, will an inline function be compiled inline always? (i) Yes, always (ii) Only sometimes (iii) No, never 13. The stack is where the malloc() gets memory. TRUE / FALSE

14. What will be the output of the following lines of program code? fork(); printf("hello World!"); (i) Hello World! (ii) Hello World!Hello World! (iii) Blank 15. In following C language program, which statement would you add in the function fun so that the address of a gets stored in j? int *j; void fun(int **); fun(&j); void fun(int **k) int a = 0; /* Add the statement here*/ (i) **k = &a (ii) *j = &a (iii) *k = &a (iv) *a = &k 16. For the following tree, the pre-order traversal can be represented by (i) F, G, H, I, A, B, C, D, E, (ii) F, B, G, A, D, I, C, E, H (iii) A, B, E, D, C, F, G, H, I (iv) A, B, C, D, E, F, G, H, I

17. A thread is usually defined as a light weight process because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the followings is true? (i) On per-thread basis, the OS maintains only CPU register state (ii) The OS does not maintain a separate stack for each thread (iii) On per-thread basis, the OS does not maintain virtual memory state (iv) On per thread basis, the OS maintains only scheduling and accounting information 18. Sorting is not possible by using which of the following methods? (i) Insertion (ii) Selection (iii) Deletion (iv) Exchange 19. There are 8, 13, 14 and 15 nodes in four different trees. Which of them could have formed a full binary tree? (i) 8 (ii) 13 (iii) 14 (iv) 15 20. Which of the following statements is not true? (i) Kernel threads need not be associated with a process whereas every user thread belongs to a process (ii) User level threads are unknown to the kernel whereas the kernel is aware of the kernel threads (iii) Kernel threads are less expensive to maintain that user threads (iv) Thread creation typically uses less resources than process creation 21. Assume that a disk drive holds 10 GB of data. How many such disk drives would be required to hold 4 exabytes of data. (i) 40,000 (ii) 400,000 (iii) 400,000,000 (iv) 400,000,000,000 22. What will be the result of the following C++ language program? class base public: void basefun() cout<<"from base"<<endl; ; class deri:public base public: void basefun() cout<< "from derived"<<endl; ; void SomeFunc(base *baseobj)

baseobj->basefun(); int base baseobject; SomeFunc(&baseObject); deri deriobject; SomeFunc(&deriObject); (i) from derived from derived (ii) from base from derived (iii) from derived from base (iv) from base from base 23. Which of the following statements is not true? (i) To provide the value of a private variable to the outside world, the programmer can write a public member function, usually classified as an accessor function. (ii) The header file describes the interface to a class. (iii) Storage is allocated for the structure when a variable of that structure type is declared. (iv) Accessor functions allow for the passing of values into the class and the setting of private or protected data members. 24. Consider the following function prototype: size_t getlength( void ) const; The compiler will. (i) Will throw an error outright (ii) Will throw an error if the definition includes any code that inadvertently assigns a value to any variable in the enclosing class (iii) Will throw an error if the definition includes any code at all 25. The smallest integer that can be represented by an 8-bit number in 2 s complement form is (i) -256 (ii) -128 (iii) -127 (iv) 0