wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Understanding C Programming Basics

Total questions: 65

Worksheet time: 54mins

Name
Class
Date
1.

What does C stand for in the C programming language?

a)

C++

b)

C#

c)

C

d)

C Language

2.

Who developed the C programming language?

a)

Bjarne Stroustrup

b)

Dennis Ritchie

c)

Linus Torvalds

d)

James Gosling

3.

What is the file extension for C source files?

a)

.cpp

b)

.java

c)

.py

d)

.c

4.

What is the purpose of the main() function in C?

a)

The main() function is used for defining global variables.

b)

The main() function is where all the functions are declared.

c)

The main() function is responsible for memory allocation.

d)

The main() function is the entry point of a C program.

5.

How do you declare a variable in C?

a)

var x int;

b)

To declare a variable in C, use the syntax: type variable_name; e.g., int x;.

c)

int x = 5;

d)

declare int x;

6.

What is the difference between int and float in C?

a)

int can store decimal values, while float cannot.

b)

int represents whole numbers, while float represents decimal numbers.

c)

float is used for character data, while int is for numeric data.

d)

int and float are interchangeable in C programming.

7.

What is a pointer in C?

a)

A pointer is a constant value in C.

b)

A pointer is a variable that holds the address of another variable in C.

c)

A pointer is a variable that stores a string in C.

d)

A pointer is a type of function in C.

8.

How do you create a comment in C code?

a)

Use '//' for single-line comments and '/* ... */' for multi-line comments.

b)

Use '//' for multi-line comments

c)

Use '#' for comments

d)

Use '/*' for single-line comments

9.

What is the use of the #include directive?

a)

To comment out sections of code.

b)

To specify the programming language used in the file.

c)

To define a new function in the source code.

d)

To include the contents of a file or library in the source code.

10.

What is an array in C?

a)

A pointer to a memory address

b)

A variable that can hold multiple data types

c)

A function that returns a single value

d)

An array in C is a collection of elements of the same type stored in contiguous memory locations.

11.

How do you define a function in C?

a)

return_type function_name(parameter_type parameter_name) { // function body }

b)

return_type { function_name(parameter_type parameter_name) }

c)

function_name { return_type parameter_type parameter_name }

d)

function_name(parameter_type) return_type { // body }

12.

What is the purpose of the return statement?

a)

To comment out a section of code.

b)

To exit a function and optionally return a value to the caller.

c)

To define a variable within a function.

d)

To create a loop in the code.

13.

What are control structures in C?

a)

Control structures in C include conditional statements and loops that control the flow of execution.

b)

Functions and procedures

c)

Data types and variables

d)

Memory management techniques

14.

What is the difference between while and for loops?

a)

'While' loops are always faster than 'for' loops regardless of the situation.

b)

The main difference is that 'for' loops are used for a known number of iterations, while 'while' loops are used for an unknown number of iterations based on a condition.

c)

'For' loops require a condition to run, while 'while' loops do not.

d)

'For' loops can only iterate over arrays, while 'while' loops cannot.

15.

How do you handle errors in C?

a)

Use return values, errno, and custom error handling functions.

b)

Ignore errors completely

c)

Always print error messages to the console

d)

Use global variables for error tracking

16.

What is a structure in C?

a)

A structure in C is a built-in data type for integers.

b)

A structure in C is a function that performs operations on data.

c)

A structure in C is a way to define constants in a program.

d)

A structure in C is a user-defined data type that groups different data types.

17.

What is the significance of the semicolon in C?

a)

The semicolon indicates a comment in C.

b)

The semicolon signifies the end of a statement in C.

c)

The semicolon is used to declare variables in C.

d)

The semicolon is used to define functions in C.

18.

How do you allocate memory dynamically in C?

a)

Use 'free' to allocate memory

b)

Use 'sizeof' to allocate memory

c)

Use 'printf' to allocate memory

d)

Use 'malloc', 'calloc', or 'realloc' functions from stdlib.h to allocate memory dynamically.

19.

What is the use of the sizeof operator?

a)

The sizeof operator calculates the total memory usage of a program.

b)

The sizeof operator returns the size of a data type or object in bytes.

c)

The sizeof operator is used to define new data types.

d)

The sizeof operator converts data types to their string representations.

20.

What are the standard libraries available in C?

a)

, , , , ,

b)

c)

d)

21.

Pada skrip program, void setup merupakan....

a)

program akhir

b)

program yang ditengah

c)

serial program

d)

awal program

22.

tanda ; (titik koma) merupakan ...

a)

awal program

b)

akhir program

c)

akhir setiap baris program

d)

menentukan awal program

23.

kode program yang digunakan untuk menyimpan suatu nilai pada sebuah nama adalah ...

a)

variabel

b)

integer

c)

boolean

d)

float

24.

Pada operator matematika perkalian menggunakan simbol...

a)

+

b)

x

c)

*

d)

/

25.

Apakah fungsi dari scanf ?

a)

Menampilkan hasil input

b)

Menampilkan hasil output

c)

Mengeksekusi program

d)

Menghilangkan variabel

26.

Apakah fungsi dari tipe data char?

a)

Menulis karakter

b)

Menulis nilai huruf

c)

Memberikan efek

d)

Memberi warna

27.

Apakah fungsi dari tipe data string?

a)

Untuk teks

b)

Untuk angka

c)

Untuk bilangan

d)

Untuk nilai

28.

Penulisan header pada program diawali dengan....

a)

#include

b)

Int main

c)

Getch();

d)

iostream

29.

Merupakan proses menerjemahkan bahasa manusia kedalam bahasa yang dimengerti komputer disebut ?

a)

Debug

b)

Compile

c)

Expent

d)

Header

30.

Suatu tempat untuk menampung nilai atau data yang dapat berubah-ubah disebut?

a)

define

b)

Shorting

c)

Main

d)

variabel

31.

Yang bukan tipe data yang bersifat numerik adalah ...

a)

Float

b)

Long

c)

Char

d)

Short

32.

Suatu bilangan yang nilainya tetap adalah?

a)

konstanta

b)

konstitusi

c)

konichiwa

d)

konbanwa

33.

Dibawah ini merupakan tipe data bilangan bulat....

a)

Int

b)

Char

c)

String

d)

Cin

e)

Float

34.

Relasi > menunjukkan

a)

Lebih besar daripada

b)

Lebih kecil dsripada

c)

Sama dengan

d)

Tidak samadengan

35.
Pada Bahasa C, sintak yang ditandai dengan dua garis miring "//" atau pun garis miring dan bintang "/* …......*/ adalah …
a)
Preprocessor
b)
Komentar
c)
Variabel
d)
Program Utama
36.

Perhatikan contoh program berikut. fungsi #include <> pada program tersebut adalah untuk …

a)

Memanggil variabel

b)

Memanggil fungsi utama

c)

Memanggil pustaka/library

d)

Memanggil komentar

37.
Klasifikasi data yang membagi data dalam beberapa jenis sehingga komputer mampu mengenali maksud dari program disebut juga…
a)
Variabel
b)
Tipe data
c)
operator
d)
fungsi
38.
Tipe data yang hanya dapat menyatakan benar(1) dan salah(0) adalah…
a)
Integer
b)
Float
c)
char
d)
Boolean
39.
Perhatikan permasalahan berikut. Rudi ingin membuat program untuk menghitung luas suatu bangunan. Nilai yang akan Rudi masukan adalah dalam satuan meter dan berupa nilai pecahan. Berdasarkan permasalahan tersebut, maka variabel yang tepat untuk digunakan oleh Rudi adalah …
a)
bool
b)
int
c)
char
d)
float
40.
Karakter khusus yang digunakan untuk mengoperasikan dua value/nilai atau lebih seperti pertambahan pengurangan dan sebagainya disebut …
a)
Operator
b)
Variabel
c)
Tipe data
d)
Struktur
41.
Operator yang digunakan untuk menjumlahkan memiliki symbol …
a)
=
b)
*
c)
+
d)
%
42.
Operator yang digunakan untuk mengkalikan memiliki symbol …
a)
=
b)
*
c)
+
d)
%
43.
Operator yang digunakan untuk memberi nilai memiliki symbol …
a)
=
b)
*
c)
+
d)
%
44.

Merupakan proses menterjemahkan bahasa manusia kedalam bahasa yang dimengerti komputer disebut?

a)

Debug

b)

Compile

c)

Run

d)

Error

45.

Hasil = a*b; merupakan

a)

Penjumlahan

b)

Pembagian

c)

Pengurangan

d)

Perkalian

46.

Bahasa Pemrograman C adalah

a)

Sebuah bahasa Pemrograman Komputer yang bisa digunakan untuk membuat berbagai aplikasi

b)

Sebuah bahasa Pemrograman Komputer yang bisa digunakan untuk menerjemahkan Bahasa

c)

Sebuah bahasa Pemrograman Komputer yang bisa digunakan untuk membuat Diagram Alir

d)

ebuah bahasa Pemrograman Komputer yang bisa digunakan untuk membuat Desain

47.

Bahasa Pemrograman C dibuat Pertama kali Oleh

a)
Bill Gates
b)
Dennis Ritchie
c)
Mark Zuckerberg
d)
Larry Page
48.

Pada tahun berapa Bahasa C dibuat untuk pertama kali??

a)
1972
b)
1980
c)
1960
d)
1990
49.

dibawah ini yang tidak merupakan bahasa pemrograman adalah

a)
Python
b)
Java
c)
Bahasa Indonesia
d)

C

50.

fungsi Source Code #include <stdio.h> di bahasa c adalah

a)
Untuk memasukkan library standar input-output
b)
Untuk mengaktifkan fungsi matematika
c)
Untuk memasukkan library grafik
d)
Untuk memasukkan library string
51.

fungsi source code Printf

dalam bahasa c adalah

a)
Untuk mencetak teks atau variabel ke output standar
b)
Untuk membaca input dari pengguna
c)
Untuk menginisialisasi variabel
d)
Untuk mengakhiri program
52.

fungsi source code \n

dalam bahasa c adalah

a)
Mengakhiri baris
b)
Membuat tab baru
c)
Menghapus karakter sebelumnya
d)
Membuka file baru
53.

Output dari Source code di samping adalah

a)

Print (" Hello Word\n")

b)

(" Hello Word\n")

c)

Hello Word\n

d)

Hello Word

54.

dibawah ini yang merupakan simbol komentar di bahasa c adalah

a)

{}

b)
/* */
c)
#
d)
/*
55.

dari Source code di samping apabila Variabel A di input nilai 8 dan Variabel B di input nilai 4 hasilnya adalah

a)

8

b)

12

c)

16

d)

4

56.

Penulisan header pada program diawali dengan....

a)

#include

b)

Int main

c)

Getch();

d)

iostream

57.

tanda ; (titik koma) merupakan ...

a)

awal program

b)

akhir program

c)

akhir setiap baris program

d)

menentukan awal program

58.

Bahasa Pemrograman C adalah

a)

Sebuah bahasa Pemrograman Komputer yang bisa digunakan untuk membuat berbagai aplikasi

b)

Sebuah bahasa Pemrograman Komputer yang bisa digunakan untuk menerjemahkan Bahasa

c)

Sebuah bahasa Pemrograman Komputer yang bisa digunakan untuk membuat Diagram Alir

d)

ebuah bahasa Pemrograman Komputer yang bisa digunakan untuk membuat Desain

59.

Bahasa Pemrograman C dibuat Pertama kali Oleh

a)
Bill Gates
b)
Dennis Ritchie
c)
Mark Zuckerberg
d)
Larry Page
60.

Pada tahun berapa Bahasa C dibuat untuk pertama kali??

a)
1972
b)
1980
c)
1960
d)
1990
61.

dibawah ini yang tidak merupakan bahasa pemrograman adalah

a)
Python
b)
Java
c)
Bahasa Indonesia
d)

C

62.

fungsi Source Code #include <stdio.h> di bahasa c adalah

a)
Untuk memasukkan library standar input-output
b)
Untuk mengaktifkan fungsi matematika
c)
Untuk memasukkan library grafik
d)
Untuk memasukkan library string
63.

fungsi source code Printf

dalam bahasa c adalah

a)
Untuk mencetak teks atau variabel ke output standar
b)
Untuk membaca input dari pengguna
c)
Untuk menginisialisasi variabel
d)
Untuk mengakhiri program
64.

fungsi source code \n

dalam bahasa c adalah

a)
Mengakhiri baris
b)
Membuat tab baru
c)
Menghapus karakter sebelumnya
d)
Membuka file baru
65.

Output dari Source code di samping adalah

a)

Print (" Hello Word\n")

b)

(" Hello Word\n")

c)

Hello Word\n

d)

Hello Word