Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

FUNKCJE2 - Odpowiedz na pytanie - funkcje (2)

1. Które wywołanie funkcji typu void jest prawidłowe:

  1. int x = f();
  2. f();
  3. cout<<f();
  4. f(int a, int b)

2. Który program wyznaczający sumę dwóch liczb jest prawidłowy:

Program pierwszy:

 

#include<iostream>
using namespace std;
int suma(int a, int b)
{
    return a+b;
}
int main()
{
    cout<<suma(2,3);
    return 0;    
}

#include<iostream>

using namespace std;

int suma(int a, int b)

{

    return a+b;

}

int main()

{

    cout<<suma(2,3);

    return 0;    

}

Program drugi
#include<iostream>
using namespace std;
int suma(int a, int b)
{
    return a+b;
}
int main()
{
    suma(2,3);
    return 0;    
}
Program trzeci
#include<iostream>
using namespace std;
int suma(int a, int b)
{
    cout<<a+b;
}
int main()
{
    cout<<suma(2,3);
    return 0;    
}
Program czwarty:
#include<iostream>
using namespace std;
void suma(int a, int b)
{
    return a+b;
}
int main()
{
    cout<<suma(2,3);
    return 0;    
}

3. Które zdanie jest nieprawdziwe:
  1. Lista argumentów to dane, które przekazujemy przez nawias funkcji
  2. Lista argumentów funkcji może być pusta
  3. Jeżeli funkcja posiada argumenty to musi zwaracać jakąś wartość
  4. Jeśli lista argumentów jest pusta, to funkcja nie pobiera żadnych danych przez nawias

4. Co wypisze następujący program:

#include<iostream>

using namespace std;

void funkcja(int a, int &b)

{

    b = b * 2;

    a/=2;

}

int main()

{

    int a = 10, b = 20;

    funkcja(a,b);

 

    cout<<a<<" "<<b;

    return 0;    

}

  1. 10 20
  2. 5 40
  3. 40 20
  4. 10 40

5. Co powinno być wstawione w miejsce kropek

#include<iostream>

using namespace std;

.... funkcja(int a, int b)

{

    return (double)a/(double)b;

}

int main()

{

    cout<<funkcja(3, 5);

    return 0;    

}

  1. void
  2. int
  3. double
  4. char

 

Input

Jedna liczba pytanie z zakresu [1..5]

Output

Jedna liczba z zakresu [1..4]

Example

Input:
6

Output:
3

Dodane przez:Marcin Kasprowicz
Data dodania:2014-02-25
Limit czasu wykonania programu:1s
Limit długości kodu źródłowego50000B
Limit pamięci:1536MB
Cluster: Cube (Intel G860)
Języki programowania:All except: ASM32-GCC ASM64 MAWK BC C-CLANG NCSHARP CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY3 R RACKET RUST SCM qobi CHICKEN SQLITE SWIFT UNLAMBDA VB.NET

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.