Category: PPL

Basic elements of Prolog

Some of the basic elements of Prolog are: Term Fact statements Rule statements 1. Term:  A Prolog term is a constant, a variable, or a structure.A constant is either an atom or an integer.Atoms are the symbolic values of Prolog and are similar to their counterparts in LISP. In particular, an atom is either a string […]

PPL Viva Voce

Most of the students were not able to answer the following questions:- 1) Example of pure functional programming paradigm? Ans. Haskell 2) Example of Logic programming paradigm? Ans. Prolog 3) Work of Lexical analysis in compilation? Ans. To validate the lexems/words. 4) What is the work of Parse tree? Ans. To check the syntax/grammar during […]

Concurrency

CONCURRENCY Concurrency is naturally divided into:  1) Instruction level concurrency,  2) Statement level concurrency (executing two or more statements simultaneously),  3) Program unit level concurrency(execute two or more subprogram units simultaneously) and  4) Program level concurrency (executing two or more programs simultaneously).  References: Sebesta,”Concept of programming Language”, Pearson Edu Louden, “Programming Languages: Principles & Practices” […]

Basic elements of Prolog

BASIC ELEMENTS OF PROLOG Some of the basic elements of Prolog are: Term Fact statements Rule statements 1. Term:  A Prolog term is a constant, a variable, or a structure. A constant is either an atom or an integer. Atoms are the symbolic values of Prolog and are similar to their counterparts in LISP. In […]

Introduction and overview of Logic programming

INTRODUCTION AND OVERVIEW OF LOGIC PROGRAMMING   Logic programming is a computer programming paradigm. Logic programming is a way of writing computer programs using languages that are based on formal logic.   Logic programs are declarative rather than procedural, which means that only the specifications of the desired results are stated rather than detailed procedures […]

Application of Logic programming

APPLICATIONS OF LOGIC PROGRAMMING 1: parsing 2: relational database management system 3: expert system 4: natural language processing solving 5: symbolic equation solving 6: planning 7: prototyping 8: simulation 9: programming language implementation References: Sebesta,”Concept of programming Language”, Pearson Edu Louden, “Programming Languages: Principles & Practices” , Cengage Learning Tucker, “Programming Languages: Principles and paradigms […]

Scope and lifetime of variable

Scope of a variable The scope of a vriable is the part of the program for which the declaration is in effect. In Java, the scope of such a variable is from its declaration to the end of the method. Lifetime of a variable The lifetime of a variable is the time period in which […]

Design issues for functions

DESIGN ISSUES FOR FUNCTIONS The following design issues are specific to functions: Are side effects allowed? What types of values can be returned? How many values can be returned? 1. Functional Side Effects: Because of the problems of side effects of functions that are called parameters to functions should always be in-mode (actual to formal parameter). This […]

Parameter passing methods

PARAMETER PASSING METHODS   Parameter-passing methods are the ways in which parameters are transmitted to and/or from called subprograms.    Parameter passing depends on model of subprogram.There are two models for parameter passing-   1. Semantics Models of Parameter Passing 2. Implementation Models of Parameter Passing   1. Semantics Models of Parameter Passing: Formal parameters are characterized by one of […]

Fundamentals of sub-programs

FUNDAMENTALS OF SUBPROGRAMS General characteristics for all subprograms except co-routines: Each subprogram has a single entry point. The calling program unit is suspended during the execution of the called subprogram. Only one subprogram remain in execution at any given time. Control always returns to the caller subprogram when the called subprogram execution terminates. Basic definitions: […]

Subprograms

Subprograms are the fundamental building blocks of programs. The two fundamental kinds of subprograms are, Functions Procedures 1. Functions: Functions return values , such that, 2. Procedures: Procedures do not return values, such that

Design issues of subprogram

Subprogram: A subprogram means a function or procedure. For example Some of the design issues of subprogram are: Are local variables static or dynamic? Can subprogram definitions appear in other subprogram definitions? What parameter-passing method or methods are used? Are the types of the actual parameters checked against the types of the formal parameters? If […]

Garbage Collection

GARBAGE COLLECTION   Garbage collection is the automatic process of making space in a computer’s memory by removing data that is not in use.   References: Sebesta,”Concept of programming Language”, Pearson Edu Louden, “Programming Languages: Principles & Practices” , Cengage Learning Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill. E Horowitz, “Programming Languages”, […]

Issues in Language Translation

ISSUES IN LANGUAGE TRANSLATION A programmer code a program using subprograms, statements, conditions, declaration etc. But a translator looks programming languages as a collection of symbols made up of thousands of characters. During translation a program is analyzed character by character.   During language translation issues occurs in the following way: Lexical analysis Syntax analysis […]

PPL: Local referencing environments

LOCAL REFERENCING ENVIRONMENTS   Local Variables Vars that are defined inside subprograms are called local vars. Local vars can be either static or stack dynamic. By default an variable in stack dynamic. Advantages of using stack dynamic variable: a. Support for recursion. b. Storage for locals is shared among some subprograms.   Disadvantages of using […]

Generic Subprograms

GENERIC SUBPROGRAMS A generic subprograms is a subprogram which have parametric polymorphism. A generic subprogram can accept different types of values of same single memory location. Parametrically polymorphic subprograms are often called generic subprograms. C++ provide a kind of compile-time parametric polymorphism. For example Generic Functions in C++: template <class Type>void show(Type a) {cout<<a;}void main(){show(10);show(10.2);show(‘c’);} References: […]

PPL: Java Threads

JAVA THREADS   Viva Voce on Java Threads Q1. What is the thread? A thread is a lightweight sub process. Q2. What is multithreading? Multithreading is a process of executing multiple threads simultaneously. Multithreading is used to obtain the multitasking. Q3. Differentiate between process and thread? There are the following differences between the process and […]

PPL: Loops

LOOPS MCQs on Loops Q1. Depending on the place of control statement in loop, it can be classified as what? (A)Entry-controlled   (B)Exit-controlled   (C)Both (A) and (B) Q2. Which of the following options show the example of entry controlled loop? (A)For loop   (B)While loop  (C)Both (A) and (B) Q3. While loop is example of which loop? (A)Entry-controlled […]

PPL: Exception Handling

C++ Exception Handling   #include < iostream.h> using namespace std;   void main() { int x,y; cout<<“Enter the value of x:”; cin>>a>>b;   cout<<“Enter the value of y:”; cin>>b;   try { if(y!=0) { cout<<“Result=” << x/y; } else { throw(y); } catch(int ex) { cout<<“Caught an exception which is:” << y ;     […]

PPL: C# Threads

C# THREADS MCQs on C# Threads   Q1. How many threads can exists for each of the processes that occurs in the program? a) at most 1 b) atleast 1 c) both at most 1 & atleast 1 Q2. Which of these classes is used to make a thread? a) String b) System c) Thread Q3. […]

PPL: Pointer & Reference Type

POINTER AND REFERENCE TYPEPointer: A pointer is a variable which is used to store the address of another variable. It is used to allocate memory dynamically at run time. The pointer variable might be int, float, char, double, short etc. Pointer syntax: int *a; Some points to remember about pointer: Pointer variable stores the address […]

Pointer & Reference Type | PPL

Pointer and Reference Type Pointer: A pointer is a variable which is used to store the address of another variable.It is used to allocate memory dynamically at run time.The pointer variable might be int, float, char, double, short etc. Pointer syntax:int *a; Some points to remember about pointer: Pointer variable stores the address of the […]

PPL: Abstraction & Encapsulation

ABSTRACTION AND ENCAPSULATION MCQs on Encapsulation Q1. Which of these is not a fundamental features of OOP? a) Encapsulation     b) Inheritance c) Instantiation Q2. Which of the following is the most suitable definition for encapsulation? a) Ability of a class to derive members of another class as a part of its own definition b) Means […]

PPL: Semaphores

SEMAPHORES A semaphore is an integer variable that apart from initialisation is accessed only through two standard atomic operators. In two processes, critical section solution can be possible using Peterson’s Solution. But an operating system is a n process system (many process system) so Semaphore solution is used here. Because Semaphore gives n process solution. […]

PPL: Introduction to 4GL

INTRODUCTION TO 4GL 4GL: Here 4GL is stands for fourth generation language. Some of the examples are VB, SQL etc. 4GL is a grouping of programming languages which are invented to get closer to human language than 3GLs. Now the question is how to 4GL is closer to human language? So we will get answer […]

PPL: Variable Initialization

VARIABLE INITIALISATION MCQs on Variable Initialisation Q1. Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others. A. Yes B. No Q2. Which of the following special symbol allowed in a variable name? A. * (asterisk) B. | (pipeline) C. _ (underscore) Q3. By […]

PPL: Conditional Statements

CONDITIONAL STATEMENTS MCQs on Conditional Statements Q1. How many choices are possible when using a single if-else statement? a) 1 b) 2 c) 3 Q2. Which of the following are incorrect statements? If int a=4 1) if( a==4 )    2) if( 4==a )    3) if( a=4   )    4) if( 4=a   ) a) 3 […]

PPL: Array

ARRAY Array: An array is a homogeneous collection of data elements in which an individual element is identified by its position in the, relative to the first element. The individual data elements of an array are of the same type. In the languages, such as C, C++, Java, Ada, and C#, all of the elements of an array […]

PPL: Strong Typing

Strong Typing A strongly-typed programming language is one in which variable type is defined. (such as integer, character, hexadecimal, packed decimal, and so forth). If we specify a particular type to our data, the compiler will consider the data as the specified type and no other type. An example of arithmetic operation in strongly typed […]

PPL: Coroutines

COROUTINES   To understand coroutines first we should know about subroutines. In computer programming, a subroutine is a sequence of program instructions that perform a specific task. For example a program for addition, subtraction. Subroutines is also known as function. Coroutines are generalizations of the subroutines. A subroutine has the same starting point and the […]

PPL: Exception Handler in C++

EXCEPTION HANDLER IN C++ Viva Vice on Exception Handler in C++   Q1. Which keyword is used to handle the exception? ans) catch keyword Q2. Which keyword is used to throw a exception? ans) throw keyword Q3. What is the use of the ‘finally’ keyword? ans) It will be executed at the end of the program […]

PPL: OOP in PHP

OOP IN PHP   Viva Vice on OOP in PHP   Q1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class. Q2. Write basic concepts of OOPS? Classes. Objects. Abstraction. Encapsulation. Inheritance. Polymorphism. Q3. […]

Sequence Control & Expression | PPL

SEQUENCE CONTROL AND EXPRESSION   Viva Voce on Sequence control & expression   Q1. Describe static function with its usage? Ans) A function, which has a function definition prefixed with a static keyword is defined as a static function. The static function should call within the same source code. Q2. Describe Wild Pointers in C? Ans) […]

PPL: Sequence Control & Expression

SEQUENCE CONTROL AND EXPRESSION Viva Voce on Sequence control & expression Q1. Describe static function with its usage? Ans) A function, which has a function definition prefixed with a static keyword is defined as a static function. The static function should call within the same source code. Q2. Describe Wild Pointers in C? Ans) Uninitialized pointers […]