Search This Blog

Tuesday, April 29, 2025

Functions and Variables in C Programming

 Variables can be passed to a C function as arguments, and the function can access these variables as function parameters. After processing information, the function can return a value to the main C program. The question here is, can a function return its local variable to the main program? There are different possibilities; here is one of these. Can you guess the output of the code given below? Comment the reason why you think the output you are providing is the right one.




Created by: Nancy N

29-Apr-2025


Sunday, April 27, 2025

C keyword or not?

 Which of the following is NOT a C programming language keyword?

a) auto

b) external

c) sizeof

d) volatile


Created by Nancy N

@18:24 27-Apr-2025



Friday, April 25, 2025

What is a Self-Refrential structure?

 Self-referential structures are used in C and C++ programming. A self-referential structure is a structure that contains a pointer to itself, or you can say a pointer to a variable of the same type. A self-referential structure can have one or more pointer variables pointing to the same type. 

Example of simple structure:


Example of self-referential structure:


Here, nptr is a pointer variable of type struct person, and nptr is a variable in the same datatype struct person. 

In a later post, we will see how the self-referential structures are useful.

Created by Nancy K A N
@00:59 26-Apr-2025





Thursday, April 24, 2025

Interesting facts about JAVA - 3

 const is a Java reserved word with no assigned semantics to it. So, you cannot create an identifier with the name const. It is not a keyword, so it cannot be used in a Java program. It is just a prohibited word. A word that has no meaning in Java but is forbidden for any kind of use. Funny, isn't it?

If you declare to as a local variable:


On compilation, you get an error:


If you declare it as an instance variable:


On compilation, you get the following error:



By: Nancy K A N

@9:48 25-Apr-2025





Wednesday, April 23, 2025

REST - 1

 Which protocol will you use in a REST service?

a) SOAP

b) JMS

c) HTTP

d) SMTP

e) FTP

Tuesday, April 22, 2025

Design Patterns - 1

 There are three types of Gang of Four (GoF) Design patterns

1. Creational

2. Structural

3. Behavioral


Can you find which of these is a creational design pattern?

a) Facade

b) Strategy

c) Factory

d) Observer



Created and posted by Nancy N.

@15:40 pm GMT


Wednesday, April 16, 2025

Object Oriented Programming Languages

 Which of the following is/are not an Object Oriented Programming (OOP) language(s)?

a) JavaScript

b) C++

c) COBOL

d) C

Sunday, April 13, 2025

Can I use a C Macro in a Java program?

Can I use a C Macro in a java program?

The answer is YES, you can.

Java programming does not use macros, but you can use C macros in Java. To do that you can pipe the source code containing macro and Java code through the C preprocessor. Below is an example code:


Now, before you compile the Java code, pipe it to the C preprocessor:

cpp -P MacroTest.java macros/MacroTest.java

Note: Make sure all the folders are created properly before the source code is submitted to the C preprocessor.

Next, go to the macros directory to view the Java code generated by CPP.


Compile and run this source code as usual :



Follow my blog for more @ https://kannancy.blogspot.com/








Monday, April 7, 2025

Java - this keyword - 1

 In Java, this keyword can be used in more than one way. Does the program below accurately use this keyword?

What happens when you run this code?


a) Compile time error - invalid use of this at line 18

b) Runtime error - invalid nested call to a constructor

c) Program prints - hello

d) Program prints - hi


Type your answer in the comment.


Follow and share my blog for more interesting posts on programming and DS.



C Preprocessor - 1

A macro or a preprocessor statement is used by the compiler before it compiles the program to transform the program.

What is the output of the following C program?



a) Compile-time error at line 3

b) Compile-time error at line 6 

c)  Hello world!

d) Runtime error - print expected

Friday, April 4, 2025

functions and pointers Program 1

 What will happen when you run this program?




   a) Compile time error: mismatch of data type of function argument in line 7
   b) Prints garbage
   c) Prints 11 and 21
   d) Prints 11 and 22

Type your answer in a comment.



printf and scanf functions

 In which of the following header files printf and scanf functions are included?

a) inout.h

b) stdlib.h

c) stdio.h

d) io.h


Provide your answer in a comment.

Thursday, April 3, 2025

Can you guess which of these is a keyword of C Programming Language?

 Which of the following is a keyword of C Programming language?

a) printf

b) scanf

c) sizeof

d) getstr


Type the answer in a comment

Wednesday, April 2, 2025

Datatype int in C

 What is the size of an int (integer) in the C language?

a) 1 byte

b) 2 bytes

c) 4 bytes

d) depending on OS