Saltar al contingut Menu
  • Home
  • Information
  • Contact
  • Map

Programming 1 (P1)

Credits Dept. Type Requirements
9.0 (7.2 ECTS) CS
  • Compulsory for DIE
  • Compulsory for DCSFW
  • Compulsory for DCSYS


Person in charge:  (-)

General goals


Specific goals


  1. Syntax and semantics of the expressions and instructions used in an imperative programming language (C++). Basic and structured data types. Functions and actions.
  2. Iterative and recursive design.
  3. Basic schemes on sequences and tables, classical algorithms.


  1. When facing an elementary problem, find an elegant algorithm for solving it. Be able to code it with a subgroup of basic instructions of the imperative language C++
  2. Use editing, compiling and running tools to develop programs.
  3. Have resources to correct the programs when they don't work.
  4. Write programs with good style, with a relevant documentation, with the precise comments and the necessary specifications.



  1. Ability to argue in a critical and logical-mathematical manner.
  2. Ability to think in abstract terms. Ability to tackle new problems by consciously using strategies that have proved useful in solving previous problems.
  3. Ability to understand problems: given a problem, distinguish between data (or starting elements), unknowns (or what is asked for), hypotheses, and the laws applicable.


Estimated time (hours):

T P L Alt Ext. L Stu A. time
Theory Problems Laboratory Other activities External Laboratory Study Additional time

1. Introduction
T      P      L      Alt    Ext. L Stu    A. time Total 
4,0 2,0 6,0 0 6,0 6,0 0 24,0
- Introduction to algorithmics and programming.
- Concepts: Computational problem, in, out, especification, algorithm, correctness, program, programming language, editor, compiler, interpreter, execution, testing.
- Elements: Type, value, literal, constant, variable, operator and expression. Assignation. Sequential construction. Conditional construction. Iterative construction. Basic input/output. Sintax of these constructions in C++.
- Programming environment.

2. Procedures
T      P      L      Alt    Ext. L Stu    A. time Total 
2,0 1,0 3,0 0 3,0 3,0 0 12,0
- Functions, actions, calls, parameter passing (input, output, input/output; real and formal parameters; value and reference passing)
- Variable scope
- Functional decomposition
- Basic library use

3. Linear algorithms and searches
T      P      L      Alt    Ext. L Stu    A. time Total 
2,0 1,0 3,0 0 3,0 3,0 0 12,0
- Sequences
- Linear scheme
- Search scheme
- Hybrid schemes

4. Recursivity
T      P      L      Alt    Ext. L Stu    A. time Total 
2,0 1,0 3,0 0 3,0 3,0 0 12,0
Introduction to the design of recursive algorithms

5. Tables and tuples
T      P      L      Alt    Ext. L Stu    A. time Total 
6,0 3,0 9,0 0 9,0 9,0 0 36,0
- Tables.
- Multidimensional tables
- Tuples.
- Scructuring and processing data with tuples and tables

6. Fundamental algorithms
T      P      L      Alt    Ext. L Stu    A. time Total 
4,0 2,0 6,0 0 6,0 6,0 0 24,0
- Basic sorting algorithms (selection, insertion and bubble)
- Dicotomic search
- Table merging
- Merge sort
- Effiency notions

7. Consolidation and personal study
T      P      L      Alt    Ext. L Stu    A. time Total 
0 9,0 6,0 0 21,0 20,0 0 56,0

Total per kind T      P      L      Alt    Ext. L Stu    A. time Total 
20,0 19,0 36,0 0 51,0 50,0 0 176,0
Avaluation additional hours 4,0
Total work hours for student 180,0

Docent Methodolgy


Evaluation Methodgy

The final grade is computed from the following grades (all of them up to 10).

NF = course final grade
NA = grade from a new problem solving test
NL = grade from several problem solving tests, with problems taken from closed lists
NE = grade from the final exam.

The NL grade is the weighted average of 3 tests consisting in the resolution of a programming exercise. The tests will be carried out during lab classes and will use an automatic evaluator, to be described later. For each test, the problem to solve will be chosen from a list known in advance by the student for that test. To be able to take a given test a necessary condition is to have successfully submitted a minimum number of problems from that list to the automatic evaluator; otherwise, the test will be considered "not taken". The three tests will have weights 20%, 40%, and 40% in the computation of the NL grade.

The NA grade will come from the resolution of another programming exercise. As in the NL tests, the automatic evaluator will be used.
Unlike the NL testes, the exercise to be solved will not necessarily come from any previously available list, and will be carried simultaneously for all groups in the time slots assigned by the school.

The NE grade will come from a final exam taken at the end of the course, and will be solved on paper, with no computer or automatic evaluator.

The NF grade is computed as:

NF = max( 40% NE + 20% NA + 40% NL, 70% NE ).

The evaluation using the automatic evaluator works as follows:

An exercise is proposed as a problem statement and one or more public testcases. Solving the exercise means writing a correct program (according to the criteria defined next) that passes all testcases, both public and private. When a student has a program that s/he believes to be correct, s/he will submit it to the automatic evaluator that, within a few seconds, will return a veredict. The veredict will distinguish at least the situations in which the program passes both public and private testcases, the public ones but not all private ones, and none of the above. If at the end of the allowed time no program passing all public testcases has been submitted, the grade is 0.

Otherwise, instructors will manually grade the last submitted program passing all public and private testcases, if any, or else the last one passing all public testcases. If this grading detects that the progrma violates the basic rules of programming clearly stated during the course, or the program does not satisfy the requisites in the statement, or if the algorithm is clearly inappropriate, the grade is 0.

Otherwise, let V be the grade, between 0 and 5, assigned by the instructors (taking into account clarity, style, etc.). A penalty for the exercise will be computed for wrong submissions as follows: A penalty of 1 point will be added for each submission not passing the public testcases; a penalty of 0,3 will be added for each one that passes the public, but not the private testcases; up to 3 wrong submissions will be excluded from this computation (those 3 with highest weight). The problem grade is max(V+5-P,0) if the program pasess all testcases, and max(V+2,5-P,0) if it does not pass all private testcases.

Any attempt of fraud during the course will entail the application of the UPC's general academic normative and the beginning of a disciplinary process.

Basic Bibliography

  • J. Petit, S. Roura Col·leció de Problemes de P1, , .

Complementary Bibliography

  • Fatos Xhafa... [et al.] Programación en C++ para ingenieros, Thomson, 2006.
  • X. Franch ... [et al.] Introducció a la programació : problemes resolts, Edicions UPC, 2006.

Web links


Previous capacities



logo FIB © Barcelona school of informatics - Contact - RSS
This website uses cookies to offer you the best experience and service. If you continue browsing, it is understood that you accept our cookies policy.
Classic version Mobile version